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