shardingId

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeNow time.Time

Functions

This section is empty.

Types

type IdGenerator

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

ID generator structure

func NewIdGenerator

func NewIdGenerator(table string, tag string, vc configmanager.Version, instanceId int64) (iw *IdGenerator, err error)

NewIDWorker : init id generator for specific business entity

func NewSubId

func NewSubId(table string, tag string, vc configmanager.Version, parentId int64) (iw *IdGenerator, err error)

func (*IdGenerator) NextID

func (iw *IdGenerator) NextID() (uID int64, err error)

NextID : get next ID

type IdStruct

type IdStruct struct {
	//Id Id值
	Id int64
	//BusinessNumber 根据tag计算出来业务hash值
	BusinessNumber int64
	//DbId 分库ID
	DbId int64
	//Sequence 当前顺序号
	Sequence int64
	//InstanceId 分库实例
	InstanceId int64
	//AlgVer 分库分表Version
	AlgVer int64
	//TimeStamp 时间戳
	TimeStamp int64
	Time      time.Time
}

ID structure

func ParseId

func ParseId(id int64) IdStruct

ParseId : parse id to IdStruct

func ParseStringId

func ParseStringId(id string) IdStruct

ParseId : parse id to IdStruct

func (IdStruct) IsNullObject

func (i IdStruct) IsNullObject() bool

Jump to

Keyboard shortcuts

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