Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCapOverflow = errors.New("snowflake: capacity overflow")
ErrCapOverflow capacity overflow in snowflake
View Source
var ErrNoIDs = errors.New("uuid: no id in queue")
ErrNoIDs no id is generated in queue
View Source
var ErrNodeOverflow = errors.New("snowflake: node is up to 999")
ErrNodeOverflow node overflow in snowflake
Functions ¶
This section is empty.
Types ¶
type IDGenerator ¶
type IDGenerator interface {
NewID() (string, error)
NewTimeID() (string, error)
NewWith(t time.Time) (string, error)
}
IDGenerator uuid generator
func NewSnowflake ¶
func NewSnowflake(ctx context.Context, current, cap int64, nodeID int, timeZone int, timeLayout string) (IDGenerator, error)
NewSnowflake 创建雪花ID生成器实例
Click to show internal directories.
Click to hide internal directories.