Thomas Boerger b6a95a8cb3 | 8 years ago | |
---|---|---|
.. | ||
LICENSE | 8 years ago | |
README.md | 8 years ago | |
array.go | 8 years ago | |
rfc4122.go | 8 years ago | |
saver.go | 8 years ago | |
state.go | 8 years ago | |
struct.go | 8 years ago | |
timestamp.go | 8 years ago | |
uuids.go | 8 years ago |
This package provides RFC 4122 compliant UUIDs. It will generate the following:
Functions NewV1, NewV3, NewV4, NewV5, New, NewHex and Parse() for generating versions 3, 4 and 5 UUIDs are as specified in RFC 4122.
Go 1.4, 1.3, 1.2 and tip supported.
Use the go
tool:
$ go get github.com/twinj/uuid
See documentation and examples for more information.
var config = uuid.StateSaverConfig{SaveReport: true, SaveSchedule: 30 * time.Minute}
uuid.SetupFileSystemStateSaver(config)
u1 := uuid.NewV1()
uP, _ := uuid.Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
u3 := uuid.NewV3(uP, uuid.Name("test"))
u4 := uuid.NewV4()
fmt.Printf(print, u4.Version(), u4.Variant(), u4)
u5 := uuid.NewV5(uuid.NamespaceURL, uuid.Name("test"))
if uuid.Equal(u1, u3) {
fmt.Printf("Will never happen")
}
fmt.Printf(uuid.Formatter(u5, uuid.CurlyHyphen))
uuid.SwitchFormat(uuid.BracketHyphen)
This is a derivative work
Orginal version from Copyright (C) 2011 by Krzysztof Kowalik chris@nu7hat.ch. See COPYING file for details.
Also see: Algorithm details in RFC 4122.
Copyright (C) 2014 twinj@github.com See LICENSE file for details.