Skip to content

v0.0.2

Latest
Compare
Choose a tag to compare
@ikouchiha47 ikouchiha47 released this 04 Mar 20:21

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()