shortid

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Setting added in v0.0.15

type Setting struct {
	Worker   uint8
	Alphabet string
	Seed     uint64
}

type ShortID

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

func New

func New(ss ...*Setting) *ShortID

New creates a new ShortID generator with a unique node.

func (ShortID) Name

func (s ShortID) Name() string

Name returns the name of the generator.

func (ShortID) Size

func (s ShortID) Size() int

Size returns the bit size of the generated ShortID ID.

func (ShortID) String added in v0.2.15

func (s ShortID) String() string

String generates a new ShortID ID as a string.

func (ShortID) ValidateString added in v0.2.15

func (s ShortID) ValidateString(id string) bool

ValidateString checks if the provided ID is a valid ShortID ID.

Jump to

Keyboard shortcuts

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