shortid

package
v0.0.42 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 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) Gen

func (s ShortID) Gen() string

Gen generates a new ShortID ID as a string.

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) Validate

func (s ShortID) Validate(id string) bool

Validate 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