Documentation ¶
Index ¶
- Variables
- type Snowflake
- type 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
Constants ¶
This section is empty.
Variables ¶
View Source
var (
InvalidSystemClock = errors.New("invalid system clock")
)
Functions ¶
This section is empty.
Types ¶
type Snowflake ¶
type Snowflake struct {
// contains filtered or unexported fields
}
func NewSnowflake ¶
type SnowflakeFactory ¶
type SnowflakeFactory struct {
// contains filtered or unexported fields
}
func NewSnowflakeFactory ¶
func NewSnowflakeFactory(bitLenWorkerID, bitLenSequence, gapMs uint, startTime time.Time) *SnowflakeFactory
func (*SnowflakeFactory) CurrentElapsedTime ¶
func (f *SnowflakeFactory) CurrentElapsedTime() uint64
func (*SnowflakeFactory) FlakeTimestamp ¶
func (f *SnowflakeFactory) FlakeTimestamp(t time.Time) uint64
func (*SnowflakeFactory) MaskSequence ¶
func (f *SnowflakeFactory) MaskSequence(sequence uint32) uint32
func (*SnowflakeFactory) MaxSequence ¶
func (f *SnowflakeFactory) MaxSequence() uint32
func (*SnowflakeFactory) MaxTime ¶
func (f *SnowflakeFactory) MaxTime() time.Time
func (*SnowflakeFactory) MaxWorkerID ¶
func (f *SnowflakeFactory) MaxWorkerID() uint32
func (*SnowflakeFactory) NewSnowflake ¶
func (f *SnowflakeFactory) NewSnowflake(workerID uint32) (*Snowflake, error)
Click to show internal directories.
Click to hide internal directories.