idtool

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReallocStep          = 100
	ReallocThreshold     = 20
	ReallocCheckInterval = 5
)

Variables

This section is empty.

Functions

func GetId

func GetId(keyName string) (uint64, error)

func IdListToStr

func IdListToStr(idList *[]uint64) string

将id列表变成分号分隔的数字列表字符串

func IdStrToId64List

func IdStrToId64List(idStr string, idList *[]uint64) error

将分号分隔的数字列表字符串转换为id列表

func IdStrToIdList

func IdStrToIdList(idStr string, idList *[]uint32) error

将分号分隔的数字列表字符串转换为id列表

func Init

func Init(keyName string) error

func Intersection

func Intersection(a *[]uint64, b *[]uint64, dest *[]uint64)

交集

Types

type IdKeeper

type IdKeeper struct {
	KeyName   string
	Lock      sync.Mutex
	Step      uint32
	Count     uint32
	Start     uint64
	FormerEnd uint64
	NewStart  uint64
	End       uint64
}

id range: [Start, FormerEnd),[NewStart, End)

func GetIdKeeper

func GetIdKeeper() *IdKeeper

func (*IdKeeper) GetId

func (keeper *IdKeeper) GetId(keyName string) (uint64, error)

func (*IdKeeper) Init

func (keeper *IdKeeper) Init(keyName string) error

Jump to

Keyboard shortcuts

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