Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/DairAidarkhanov/nanoid
A tiny and fast Go unique string generator
https://github.com/DairAidarkhanov/nanoid
go nanoid
Last synced: about 1 month ago
JSON representation
A tiny and fast Go unique string generator
- Host: GitHub
- URL: https://github.com/DairAidarkhanov/nanoid
- Owner: aidarkhanov
- License: mit
- Archived: true
- Created: 2019-07-02T12:15:56.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-09-21T01:40:22.000Z (over 2 years ago)
- Last Synced: 2024-06-19T15:57:34.436Z (6 months ago)
- Topics: go, nanoid
- Language: Go
- Homepage:
- Size: 32.2 KB
- Stars: 60
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
- awesome-go-extra - nanoid - 07-02T12:15:56Z|2021-09-15T22:25:23Z| (UUID / Fail injection)
README
# Nano ID [![GoDoc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-round)](https://pkg.go.dev/github.com/aidarkhanov/nanoid/v2)
### A tiny and fast _Go_ unique string generator
* __Safe__. It uses cryptographically strong random APIs and tests distribution of symbols.
* __Compact__. It uses a larger alphabet than UUID `(A-Za-z0-9_-)`. So ID size was reduced from 36 to 21 symbols.```go
id, err := nanoid.New() //> "i25_rX9zwDdDn7Sg-ZoaH"
if err != nil {
log.Fatalln(err)
}
```### Installation
Once Go is installed, run the following command to get Nano ID.
```sh
go get github.com/aidarkhanov/nanoid/v2
```### Documentation
The package reference is located at [pkg.go.dev/github.com/aidarkhanov/nanoid/v2](https://pkg.go.dev/github.com/aidarkhanov/nanoid/v2).
### Roadmap
* The API of this package is frozen.
* Release patches if necessary.### License
This package is provided under MIT/Expat license. See [LICENSE.md](https://raw.githubusercontent.com/aidarkhanov/nanoid/master/LICENSE) file for details.
### Thanks to
* [Andrey Sitnik](https://github.com/ai) for [the original JavaScript algorithm](https://github.com/ai/nanoid) implementation.
* [Paul Yuan](https://github.com/puyuan) for letting me improve [the Python version](https://github.com/puyuan/py-nanoid) of the library. Without the previous work, I would not be able to fully understand the algorithm.