Documentation ¶
Index ¶
Constants ¶
View Source
const ( //SnowFlake 雪花算法 StartTimeStamp = int64(1483228800000) //开始时间截 (2017-01-01) MachineIdBits = uint(4) //机器id所占的位数 SequenceBits = uint(4) //序列所占的位数 //MachineIdMax = int64(-1 ^ (-1 << MachineIdBits)) //支持的最大机器id数量 SequenceMask = int64(-1 ^ (-1 << SequenceBits)) // MachineIdShift = SequenceBits //机器id左移位数 TimestampShift = SequenceBits + MachineIdBits //时间戳左移位数 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ISnowFlake ¶
func SnowflakeIdGenerator ¶
func SnowflakeIdGenerator() ISnowFlake
Click to show internal directories.
Click to hide internal directories.