Skip to content

billglover/uid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uid

A package for generating unique identifiers, loosely based on MongoDB's ObjectId.

Identifiers are 12-bytes and roughly time sortable.

  • a 4-byte value representing the seconds since the Unix epoch,
  • a 3-byte machine identifier,
  • a 2-byte process id, and
  • a 3-byte counter, starting with a random value.

Documentation

Package documentation available on GoDoc: uid: github.com/billglover/uid

Benchmarks

goos: darwin
goarch: amd64
pkg: github.com/billglover/uid
BenchmarkUID-4          10000000               189 ns/op
BenchmarkUIDString-4    10000000               186 ns/op

About

A package for generating unique identifiers, loosely based on Twitter's Snowflake

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages