id

package
v0.0.0-...-dfe2c77 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCode

func NewCode(id uint64, options ...func(*CodeOptions)) string

NewCode can get a unique code by id(You need to ensure that id is unique).

func WithCodeChars

func WithCodeChars(arr []rune) func(*CodeOptions)

func WithCodeL

func WithCodeL(l int) func(*CodeOptions)

func WithCodeN1

func WithCodeN1(n int) func(*CodeOptions)

func WithCodeN2

func WithCodeN2(n int) func(*CodeOptions)

func WithCodeSalt

func WithCodeSalt(salt uint64) func(*CodeOptions)

func WithSonyflakeMachineId

func WithSonyflakeMachineId(id uint16) func(*SonyflakeOptions)

func WithSonyflakeStartTime

func WithSonyflakeStartTime(startTime time.Time) func(*SonyflakeOptions)

Types

type CodeOptions

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

type Sonyflake

type Sonyflake struct {
	Error error
	// contains filtered or unexported fields
}

func NewSonyflake

func NewSonyflake(options ...func(*SonyflakeOptions)) *Sonyflake

NewSonyflake can get a unique code by id(You need to ensure that id is unique).

func (*Sonyflake) Id

func (s *Sonyflake) Id(ctx context.Context) (id uint64)

type SonyflakeOptions

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

Jump to

Keyboard shortcuts

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