snowflake

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExceedNode = errors.New("node编号超出限制")
	ErrExceedApp  = errors.New("app编号超出限制")
	ErrUnknownApp = errors.New("未知的app")
)

Functions

This section is empty.

Types

type ID

type ID int64

func (ID) AppID

func (f ID) AppID() uint

AppID 返回生成时输入的appid

func (ID) Int64

func (f ID) Int64() int64

type UIDGenerator

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

func NewUIDGenerator

func NewUIDGenerator(nodeId uint, apps uint) (*UIDGenerator, error)

NewUIDGenerator nodeId表示第几个节点,apps表示有几个应用 从0开始排序 0-webook 1-ielts 最多到31

func (*UIDGenerator) Generate

func (c *UIDGenerator) Generate(appid uint) (ID, error)

Jump to

Keyboard shortcuts

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