Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ybubnov/go-uuid
A wrapper for Linux kernel UUID v4 generator.
https://github.com/ybubnov/go-uuid
go uuid
Last synced: about 9 hours ago
JSON representation
A wrapper for Linux kernel UUID v4 generator.
- Host: GitHub
- URL: https://github.com/ybubnov/go-uuid
- Owner: ybubnov
- License: mit
- Created: 2017-01-02T17:57:30.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-02-06T11:18:53.000Z (over 2 years ago)
- Last Synced: 2023-08-14T09:59:06.822Z (about 1 year ago)
- Topics: go, uuid
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 28
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-uuid - A wrapper for Linux kernel UUID v4 generator.
[![Build Status][BuildStatus]](https://travis-ci.org/ybubnov/go-uuid)
[![Documentation][Documentation]](https://godoc.org/github.com/ybubnov/go-uuid)This UUID library is an yet another attempt to reimplement the wheel, but
instead of outstanding algorithm it wraps the Linux kernel implementation
of UUID v4 generator.## Installation
The latest version can be installed using ```go``` tool:
```sh
go get github.com/ybubnov/go-uuid
```## Usage
### Trivial configuration
The usage is pretty straightforward. Here is the most trivial example:
```go
package mainimport (
"fmt""github.com/ybubnov/go-uuid"
)func main() {
u1 := uuid.New()
fmt.Printf("uuid v4: %s\n", u1)
}
```### Advanced configuration
Another example shows an advanced configuration of generator. It defines the
```128``` buffered UUIDs, and 16 workers used to produce them.```go
package mainimport (
"fmt""github.com/ybubnov/go-uuid"
)func main() {
src := uuid.Kernel{MaxIdle: 128, MaxProcs: 16}
defer src.Stop() // Terminate source when time comes.u1, err := src.Next()
if err != nil {
fmt.Printf("failed to generate uuid: %s\n", err)
}fmt.Printf("uuid v4: %s\n", u1)
}
```## Licence
The UUID library is distributed under MIT license, therefore you are free to do
with code whatever you want. See the [LICENSE](LICENSE) file for full license text.[BuildStatus]: https://travis-ci.org/ybubnov/go-uuid.svg?branch=master
[Documentation]: https://godoc.org/github.com/ybubnov/go-uuid?status.svg