nanoid

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: MIT Imports: 2 Imported by: 0

README

nanoid

nanoid is a Go implementation of the nanoid library.

Installation

go get github.com/nlgolib/nanoid

Functionality Highlights

  • Generate Nanoid with custom alphabet and size
  • Generate Nanoid without alike characters (1lI0Oouv5Ss)
  • Generate safe Nanoid (length 21), which is proofed to be collision free

Documentation

Index

Constants

View Source
const (
	ALPHABET_NUMBERS   = "0123456789"
	ALPHABET_LOWERCASE = "abcdefghijklmnopqrstuvwxyz"
	ALPHABET_UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
)

Variables

This section is empty.

Functions

func New

func New(size int, alphabet string) (string, error)

New generates a new nanoid with the given size and alphabet.

func NewSafe

func NewSafe() string

NewSafe generates a new nanoid with all alphabet characters without alike characters. The length is 21, which is proofed to be safe from collisions.

func NewWithoutAlike

func NewWithoutAlike(size int, alphabet string) (string, error)

NewWithoutAlike generates a new nanoid without alike characters (1lI0Oouv5Ss). It removes the alike characters from the alphabet and generates a new nanoid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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