|
1 year ago | |
---|---|---|
internal | 1 year ago | |
LICENSE | 1 year ago | |
README.md | 1 year ago | |
go.mod | 1 year ago | |
go.sum | 1 year ago | |
oid36.go | 1 year ago | |
oid36_test.go | 1 year ago |
encode ObjectID to Base36 and back
id := primitive.NewObjectID().Hex()
fmt.Println(id)
out, e := oid36.ObjectIDToBase36(id)
if e != nil {
t.Error(e)
t.Fail()
return
}
fmt.Println(out)
Shamelessly stolen base36 code from github.com/martinlindhe/base36.
If not for tests go.mongodb.org/mongo-driver/bson would not've been a dependency.