https://github.com/bsm/go-guid
MongoDB style globally unique identifiers in Go
https://github.com/bsm/go-guid
go golang guid unique-id
Last synced: about 1 year ago
JSON representation
MongoDB style globally unique identifiers in Go
- Host: GitHub
- URL: https://github.com/bsm/go-guid
- Owner: bsm
- License: mit
- Created: 2015-05-17T10:38:10.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-08-31T10:32:11.000Z (almost 9 years ago)
- Last Synced: 2025-04-25T14:03:36.794Z (about 1 year ago)
- Topics: go, golang, guid, unique-id
- Language: Go
- Size: 12.7 KB
- Stars: 16
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GUID
[](https://travis-ci.org/bsm/go-guid)
[](http://godoc.org/github.com/bsm/go-guid)
[](https://goreportcard.com/report/github.com/bsm/go-guid)
[](https://opensource.org/licenses/MIT)
Simple, thread-safe MongoDB style GUID generator.
### Examples
```go
func main {
// Create a new 12-byte globally-unique identifier
id := guid.New96()
fmt.Println(hex.EncodeToString(id.Bytes()))
}
```
```go
func main {
// Create a new 16-byte globally-unique identifier
id := guid.New128()
fmt.Println(hex.EncodeToString(id.Bytes()))
}
```