keys

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 8 Imported by: 0

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 NewHiLo

func NewHiLo(ctx context.Context, low, high int64, weight int, timeFormat string) IDGenerator

NewHiLo create a IDGenerator instance based on Hi/Lo algorithm

func NewSnowflake

func NewSnowflake(ctx context.Context, current, cap int64, nodeID int, timeZone int, timeLayout string) (IDGenerator, error)

NewSnowflake 创建雪花ID生成器实例

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL