Documentation ¶
Overview ¶
Package nanoid is a tiny, unique string ID generator
Index ¶
Constants ¶
View Source
const (
// DefaultAlphabet is the default alphabet for the generator which can be used to generate kernel interface names
DefaultAlphabet = "!\"#$&'()*+,-.012456789;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
)
Variables ¶
This section is empty.
Functions ¶
func GenerateLinuxInterfaceName ¶
GenerateLinuxInterfaceName - returns a random interface name with "nsm" prefix to achieve a 1% chance of name collision, you need to generate approximately 68 billon names
func GenerateString ¶
GenerateString generates a random string based on size. Original JavaScript implementation: https://github.com/ai/nanoid/blob/main/README.md
Types ¶
type Option ¶
type Option func(o *generatorOpts)
Option represents options for the string generator
func WithAlphabet ¶
WithAlphabet sets a custom alphabet for the generator
func WithRandomByteGenerator ¶
WithRandomByteGenerator sets a generator for random bytes generation
Click to show internal directories.
Click to hide internal directories.