idgen

package
v0.0.0-...-d436db8 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenId

func GenId() uint64

获取id |version:4bit|timestamp:39bit|shardId:13bit|squence:8bit

func GenIdInt64

func GenIdInt64() int64

func GetSequence

func GetSequence(id uint64) uint64

获取id当前的序列号

func GetShardId

func GetShardId(id uint64) int

获取id的分区id(组件唯一标识)

func GetTime

func GetTime(id uint64) time.Time

获取id生成时间Time

func GetTimeUnixMill

func GetTimeUnixMill(id int64) int64

获取id的UinxMill时间戳

func GetTimeUnixNano

func GetTimeUnixNano(id uint64) int64

获取id的UinxNano时间戳

func GetVersion

func GetVersion(id uint64) int

获取id的版本信息

func SetShardId

func SetShardId(id int) error

设置分区id

func SetVersion

func SetVersion(v int) error

设置id版本

Types

This section is empty.

Jump to

Keyboard shortcuts

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