Initial release of snowflake.
Usage:
type Repository struct {
db *sql.DB
idgen SnowflakeGenerator
}
func NewRepository(db *sql.DB) *Repository {
return &Repository{ db: db, idgen: snowflake.NewSequenceGenerator() }
}
Also for direct use, with the global id generator, you can do:
id := snowflake.NextID()