id

package
v3.10.76 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: Apache-2.0, MIT Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAlphabet = []rune("6789BCDFGHJKLMNPQRTWbcdfghjkmnpqrtwz")

DefaultAlphabet is the alphabet used for ID characters by default

View Source
var DefaultSize = 16

DefaultSize is the size used for ID by default To get uuid like collision specify 21

Functions

func Must

func Must(opts ...Option) string

Must is the same as New but fatals on error

func New

func New(opts ...Option) (string, error)

New returns new id or error

Types

type Option

type Option func(*Options)

Option func signature

func Alphabet

func Alphabet(alphabet string) Option

Alphabet specifies alphabet to use

func Size

func Size(size int) Option

Size specifies id size

type Options

type Options struct {
	Alphabet []rune
	Size     int
}

Options contains id deneration options

func NewOptions

func NewOptions(opts ...Option) Options

NewOptions returns new Options struct filled by opts

Jump to

Keyboard shortcuts

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