Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A simple encoder/decoder for converting object identifiers into a Pair Tree Path (path)

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
license.go
Notifications You must be signed in to change notification settings

caltechlibrary/pairtree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

30 Commits

Repository files navigation

Pairtree

This is a library for translate a UTF-8 string to/from a pairtree notation. This is typically used in storing things on disc (e.g. repository filesystems). This code is based on the specification found at https://confluence.ucop.edu/download/attachments/14254128/PairtreeSpec.pdf?version=2&modificationDate=1295552323000&api=v2 which is cited on the OCFL wiki.

Features

  • Set() will let you set the path separator
    • Separator is a readonly value of the file separator used by Encode() and Decode()
  • Encode() will encode the provided string as a pairtree path
  • Decode() will decode a pairtree path returning the unencoded string

Example

 import (
 "fmt"
 "os"
 "github.com/caltechlibrary/pairtree"
 )
 func main() {
 key := "12mIEERD11"
 fmt.Printf("Key: %q\n", key)
 pairPath := pairtree.Encode(key)
 fmt.Printf("Endoded key %q -> %q\n", key, pairPath)
 key = Decode(pairPath)
 fmt.Printf("Decoded path %q -> %q\n", pairPath, key)
 }

About

A simple encoder/decoder for converting object identifiers into a Pair Tree Path (path)

Topics

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
license.go

Stars

Watchers

Forks

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /