/gemshards

💎 Snowflake-like Unique ID generator

Primary LanguageGo

Snowflake-like Unique ID generator

Usage

Arguments:

  • EpochOffset 5730518316208800 (example) Epoch offset in microseconds (should remain consistent in all instances)
  • GemID 0-15 (default config) Must be unique across generator instances; otherwise, IDs can duplicate!

Example code:

package main

import (
	"fmt"

	"pkg.nyaa.science/gemshards"
)

func main() {
	generator := gemshards.Gem{EpochOffset: 5730518316208800, GemID: 0}
	shard := generator.Generate()
	fmt.Println("Unique ID:", shard.ID)
}

🙌 Contributing

Please write commit messages according to Chris Beams' guide 😊

Thank you very much for reading this 🙇🏼‍♀️