Categorygithub.com/matoous/go-nanoid
modulepackage
1.5.1
Repository: https://github.com/matoous/go-nanoid.git
Documentation: pkg.go.dev

# README

Go Nanoid

Build Status Build Status GoDoc Go Report Card GitHub issues License

This package is Go implementation of ai's nanoid!

Safe. It uses cryptographically strong random generator.

Compact. It uses more symbols than UUID (A-Za-z0-9_-) and has the same number of unique options in just 22 symbols instead of 36.

Fast. Nanoid is as fast as UUID but can be used in URLs.

Install

Via go get tool

$ go get github.com/matoous/go-nanoid

Usage

Generate ID

id, err := gonanoid.Nanoid()

Generate ID with custom alphabet and length

id, err := gonanoid.Generate("abcde", 54)

Testing

$ go test

Notice

If you use Go Nanoid in your project, please let me know!

If you have any issues, just feel free and open it in this repository, thanks!

Credits

License

The MIT License (MIT). Please see License File for more information.

# Packages

No description provided by the author

# Functions

Generate is a low-level function to change alphabet and ID size.
ID provides more golang idiomatic interface for generating IDs.
MustGenerate is the same as Generate but panics on error.
MustID is the same as ID but panics on error.
Nanoid generates secure URL-friendly unique ID.

# Variables

BytesGenerator is the default bytes generator.

# Type aliases

Generator function.