You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.8 KiB

10 years ago
  1. # UUID package for Go language
  2. [![Build Status](https://travis-ci.org/satori/go.uuid.png?branch=master)](https://travis-ci.org/satori/go.uuid)
  3. [![GoDoc](http://godoc.org/github.com/satori/go.uuid?status.png)](http://godoc.org/github.com/satori/go.uuid)
  4. This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs.
  5. With 100% test coverage and benchmarks out of box.
  6. Supported versions:
  7. * Version 1, based on timestamp and MAC address (RFC 4122)
  8. * Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1)
  9. * Version 3, based on MD5 hashing (RFC 4122)
  10. * Version 4, based on random numbers (RFC 4122)
  11. * Version 5, based on SHA-1 hashing (RFC 4122)
  12. ## Installation
  13. Use the `go` command:
  14. $ go get github.com/satori/go.uuid
  15. ## Requirements
  16. UUID package requires any stable version of Go Programming Language.
  17. It is tested against following versions of Go: 1.0, 1.1, 1.2
  18. ## Example
  19. ```go
  20. package main
  21. import (
  22. "fmt"
  23. "github.com/satori/go.uuid"
  24. )
  25. func main() {
  26. // Creating UUID Version 4
  27. u1 := uuid.NewV4()
  28. fmt.Printf("UUIDv4: %s\n", u1)
  29. // Parsing UUID from string input
  30. u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
  31. if err != nil {
  32. fmt.Printf("Something gone wrong: %s", err)
  33. }
  34. fmt.Printf("Successfully parsed: %s", u2)
  35. }
  36. ```
  37. ## Documentation
  38. [Documentation](http://godoc.org/github.com/satori/go.uuid) is hosted at GoDoc project.
  39. ## Links
  40. * [RFC 4122](http://tools.ietf.org/html/rfc4122)
  41. * [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01)
  42. ## Copyright
  43. Copyright (C) 2013 by Maxim Bublis <b@codemonkey.ru>.
  44. UUID package released under MIT License.
  45. See [LICENSE](https://github.com/satori/go.uuid/blob/master/LICENSE) for details.