id

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultIncIDCounter = NewIDCounter(Inc)
)

Functions

This section is empty.

Types

type IDCounter

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

func NewIDCounter

func NewIDCounter(mode Mode) *IDCounter

func (*IDCounter) Close

func (idCounter *IDCounter) Close()

func (*IDCounter) DelID

func (idCounter *IDCounter) DelID(i uint64)

func (*IDCounter) GetID

func (idCounter *IDCounter) GetID() uint64

func (*IDCounter) GetIDByMeta

func (idCounter *IDCounter) GetIDByMeta(meta []byte) (uint64, error)

func (*IDCounter) ReserveID

func (idCounter *IDCounter) ReserveID(id uint64)

type IDFactory

type IDFactory interface {
	ReserveID(id uint64)
	GetID() uint64
	GetIDByMeta(meta []byte) (uint64, error)
	DelID(uint64)
	Close()
}

type Mode

type Mode string
const (
	Even   Mode = "even"
	Odd    Mode = "odd"
	Unique Mode = "unique"
	Inc    Mode = "inc"
)

Jump to

Keyboard shortcuts

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