https://github.com/chilts/sid
Generate Sortable Identifiers
https://github.com/chilts/sid
go id identifier lexicographical sortable
Last synced: 6 months ago
JSON representation
Generate Sortable Identifiers
- Host: GitHub
- URL: https://github.com/chilts/sid
- Owner: chilts
- License: mit
- Created: 2017-03-07T00:10:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-06-07T04:24:38.000Z (over 6 years ago)
- Last Synced: 2025-04-02T06:41:18.709Z (6 months ago)
- Topics: go, id, identifier, lexicographical, sortable
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 33
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
- License: LICENSE
Awesome Lists containing this project
README
# sid : generate sortable identifiers
## Overview
[](https://godoc.org/github.com/chilts/sid)
[](https://travis-ci.org/chilts/sid)
[](https://codeclimate.com/github/chilts/sid)
[](https://goreportcard.com/report/github.com/chilts/sid)This package is simple and only provides one function. The aim here is not pure speed, it is for an easy use-case
without having to worry about goroutines and locking.## Install
```
go get github.com/chilts/sid
```## Example
```
id1 := sid.Id()
id2 := sid.IdHex()
id3 := sid.IdBase32()
id4 := sid.IdBase64()fmt.Printf("id1 = %s\n", id1)
fmt.Printf("id2 = %s\n", id2)
fmt.Printf("id3 = %s\n", id3)
fmt.Printf("id4 = %s\n", id4)// -> "id1 = 1559872035903071353-1186579057231285506"
// -> "id2 = 15a5cf57e7d2a837-6eaafe687e7b3ec3"
// -> "id3 = 1b9efqnl51jj7-4u66ikpfq9ugm"
// -> "id4 = 1IeSBAWW9kK-0cDG64GQgGJ"
```## Author
By [Andrew Chilton](https://chilts.org/), [@twitter](https://twitter.com/andychilton).
For [AppsAttic](https://appsattic.com/), [@AppsAttic](https://twitter.com/AppsAttic).
## License
[MIT](https://chilts.mit-license.org/2017/)
(Ends)