sole

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoIncrementInt added in v0.3.4

func AutoIncrementInt() int

AutoIncrementInt 获取一个自增的 int 值

func AutoIncrementInt32 added in v0.3.4

func AutoIncrementInt32() int32

AutoIncrementInt32 获取一个自增的 int32 值

func AutoIncrementInt64 added in v0.3.4

func AutoIncrementInt64() int64

AutoIncrementInt64 获取一个自增的 int64 值

func AutoIncrementString added in v0.3.4

func AutoIncrementString() string

AutoIncrementString 获取一个自增的字符串

func AutoIncrementUint32 added in v0.3.4

func AutoIncrementUint32() uint32

AutoIncrementUint32 获取一个自增的 uint32 值

func AutoIncrementUint64 added in v0.3.4

func AutoIncrementUint64() uint64

AutoIncrementUint64 获取一个自增的 uint64 值

func Get

func Get() int64

Get 获取全局唯一标识符

func GetWith

func GetWith(name any) int64

GetWith 获取特定命名空间的唯一标识符

func RegNameSpace added in v0.0.20

func RegNameSpace(name any)

RegNameSpace 注册特定命名空间的唯一标识符

func Reset added in v0.0.20

func Reset()

Reset 重置全局唯一标识符

func ResetWith added in v0.0.20

func ResetWith(name any)

ResetWith 重置特定命名空间的唯一标识符

func SonyflakeID

func SonyflakeID() int64

SonyflakeID 获取一个雪花id

func SonyflakeIDE

func SonyflakeIDE() (int64, error)

SonyflakeIDE 获取一个雪花id

func SonyflakeSetting

func SonyflakeSetting(settings sonyflake.Settings)

SonyflakeSetting 配置雪花id生成策略

func UnRegNameSpace added in v0.0.20

func UnRegNameSpace(name any)

UnRegNameSpace 解除注销特定命名空间的唯一标识符

Types

type Once added in v0.0.27

type Once[V any] struct {
	// contains filtered or unexported fields
}

Once 用于数据取值去重的结构体

func NewOnce added in v0.0.27

func NewOnce[V any]() *Once[V]

NewOnce 创建一个用于数据取值去重的结构实例

func (*Once[V]) Get added in v0.0.27

func (slf *Once[V]) Get(key any, value V, defaultValue V) V

Get 获取一个值,当该值已经被获取过的时候,返回 defaultValue,否则返回 value

func (*Once[V]) Reset added in v0.0.27

func (slf *Once[V]) Reset(key ...any)

Reset 当 key 数量大于 0 时,将会重置对应 key 的记录,否则重置所有记录

Jump to

Keyboard shortcuts

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