shortid

package
v0.3.19 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option = func(*Options)

type Options

type Options = sonyflake.Settings

type Sonyflake

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

func New

func New(opts ...Option) *Sonyflake

New creates a new Sonyflake generator with a unique node.

func (Sonyflake) Generate

func (s Sonyflake) Generate() int64

func (Sonyflake) GenerateNumber

func (s Sonyflake) GenerateNumber() int64

GenerateNumber generates a new Sonyflake ID as an int64.

func (Sonyflake) Name

func (s Sonyflake) Name() string

Name returns the name of the generator.

func (Sonyflake) Size

func (s Sonyflake) Size() int

Size returns the bit size of the generated Sonyflake ID.

func (Sonyflake) Validate

func (s Sonyflake) Validate(id int64) bool

func (Sonyflake) ValidateNumber

func (s Sonyflake) ValidateNumber(id int64) bool

ValidateNumber checks if the provided ID is a valid Sonyflake ID.

Jump to

Keyboard shortcuts

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