Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateMachineIDByMac ¶
Types ¶
type IDGenerator ¶
type IDGenerator interface {
GenerateID() int64
}
type SnowFlakeOption ¶
type Snowflake ¶
type Snowflake struct {
// contains filtered or unexported fields
}
func NewSmallSnowflake ¶
NewSmallSnowflake
Snowflake Structure: -------------------- | Timestamp | Machine ID | Sequence | --------------------------------------- | 32 bits | 5 bits | 15 bits | ---------------------------------------
Some environments cannot use bd NTID, and a front-end friendly id is required.
func NewSnowflake ¶
func NewSnowflake(ctx context.Context, option *SnowFlakeOption) (*Snowflake, error)
func NewStandardSnowflake ¶
func (*Snowflake) GenerateID ¶
Click to show internal directories.
Click to hide internal directories.