Versions in this module Expand all Collapse all v1 v1.0.1 Feb 20, 2024 Changes in this version + var InvalidSystemClock = errors.New("invalid system clock") + type Snowflake struct + func NewSnowflake(workerID uint32) (*Snowflake, error) + func (sf *Snowflake) ID() (uint64, error) + func (sf *Snowflake) WorkerID() uint32 + type SnowflakeFactory struct + func NewSnowflakeFactory(bitLenWorkerID, bitLenSequence, gapMs uint, startTime time.Time) *SnowflakeFactory + func (f *SnowflakeFactory) BuildID(workerID uint32, elapsedTime uint64, sequence uint32) (uint64, error) + func (f *SnowflakeFactory) CurrentElapsedTime() uint64 + func (f *SnowflakeFactory) FlakeTimestamp(t time.Time) uint64 + func (f *SnowflakeFactory) MaskSequence(sequence uint32) uint32 + func (f *SnowflakeFactory) MaxSequence() uint32 + func (f *SnowflakeFactory) MaxTime() time.Time + func (f *SnowflakeFactory) MaxWorkerID() uint32 + func (f *SnowflakeFactory) NewSnowflake(workerID uint32) (*Snowflake, error) + func (f *SnowflakeFactory) SleepTime(overtime time.Duration) time.Duration