Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orbit ID for Go

Go implementation of the Orbit ID v1 unsigned 64-bit format.

Source of truth lives in the monorepo under packages/go. Published module path is the orbit-id/go mirror (same pattern as Packagist / orbit-id/php).

Install

go get github.com/orbit-id/go@v1.1.0

Import as package orbitid:

import (
    "fmt"

    orbitid "github.com/orbit-id/go"
)

func main() {
    generator, err := orbitid.NewGenerator(orbitid.GeneratorOptions{Node: 7})
    if err != nil {
        panic(err)
    }
    id, err := generator.Generate(1)
    if err != nil {
        panic(err)
    }
    fmt.Println(orbitid.ToDecimalString(id))
}

Version tags

On each monorepo vX.Y.Z release, CI mirrors packages/go to orbit-id/go and pushes the same tag there. Consumers use that mirror tag via proxy.golang.org.

See Cross-registry versioning and Go module publishing.

API notes

Use Encode / Decode for fields, Parse for a uint64 or canonical decimal string, and IsValid for syntactic validation only. Decimal strings must be unsigned and canonical (no signs, whitespace, or leading zeroes).

Test

go test ./...

About

Orbit ID Go module (mirror of orbit-id/orbit-id packages/go). Do not open PRs here.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages