sequencenumber

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

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

Generator 包含时间和UUID生成函数

func NewGenerator

func NewGenerator() *Generator

NewGenerator 创建一个Generator实例

func NewGeneratorWith

func NewGeneratorWith(timestampGen TimestampGenerateFunc, uuidGen ShortUUIDGenerateFunc) *Generator

NewGeneratorWith 创建一个Generator实例

func (*Generator) Generate

func (s *Generator) Generate(id int64) (string, error)

Generate 使用ID生成序列号,生成 32 位长度的字符串

type ShortUUIDGenerateFunc

type ShortUUIDGenerateFunc func() string

ShortUUIDGenerateFunc 定义生成ShortUUID的函数类型

type TimestampGenerateFunc

type TimestampGenerateFunc func(time.Time) int64

TimestampGenerateFunc 定义生成时间戳的函数类型

Jump to

Keyboard shortcuts

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