snow_flake

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeWait    = 1
	ModeMaxTime = 2
	ModeError   = 3
)

Variables

View Source
var (
	ErrOutOfRange = errors.New("out of range")
	ErrTimeBack   = errors.New("time go back")
	ErrMachineId  = errors.New("illegal machine id")
	ErrLogicId    = errors.New("illegal logic id")
)

Functions

This section is empty.

Types

type SnowFlake

type SnowFlake struct {
	// contains filtered or unexported fields
}

1位0,41位毫秒时间戳,8位机器码,2位业务码,12位递增值

func New

func New(mode uint8, id uint8, timeStampBegin int64) (sf *SnowFlake, err error)

func (*SnowFlake) Id

func (sf *SnowFlake) Id(logicId uint8) (int64, error)

func (*SnowFlake) Info

func (sf *SnowFlake) Info(id int64) (timestamp int64, machineId uint8, logicId uint8, index int16)

Jump to

Keyboard shortcuts

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