Documentation
¶
Overview ¶
Package guid defines a type for globally unique identifiers. It provides functions to generate RFC 4122-compliant guids, to parse strings into guids, and to convert guids to strings.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalid = errors.New("guid: invalid format")
ErrInvalid is returned when parsing a string that is not formatted as a valid guid.
Functions ¶
Types ¶
type Guid ¶
type Guid [16]byte
Guid is a globally unique 16 byte identifier
func ParseString ¶
ParseString returns the Guid represented by the string s.
Example ¶
Parse a string containing a guid.
package main import ( "fmt" "github.com/beevik/guid" ) func main() { g, err := guid.ParseString("0e545c9c-f942-4988-4ab0-145274cfaded") if err != nil { fmt.Printf("Guid: %v\n", g) } }
Output:
func (*Guid) IsConformant ¶
IsConformant determines if the Guid is RFC 4122-conformant. If the variant is "reserved for future definition" or the version is unknown, then it is non-conformant.
func (*Guid) String ¶
String returns a standard hexadecimal string version of the Guid. Lowercase characters are used.
func (*Guid) StringUpper ¶
StringUpper returns a standard hexadecimal string version of the Guid. Uppercase characters are used.