项目作者: matoous

项目描述 :
Golang random IDs generator.
高级语言: Go
项目地址: git://github.com/matoous/go-nanoid.git
创建时间: 2017-09-12T16:51:21Z
项目社区:https://github.com/matoous/go-nanoid

开源协议:MIT License

下载


Go Nanoid

CI
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.

[!NOTE]
There’s little to no development on this repo, intentionally. It does what it needs to do. Bug reports are welcomed, features might be implemented.

If you are considering more heavy weight solution that integrates with UUIDs (supported by many databases) I would suggest you take a look at typeid or other equivalents.

Install

Via go get tool

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

Usage

Generate ID

  1. id, err := gonanoid.New()

Generate ID with a custom alphabet and length

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

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.