uuid: 4d63.com/uuid Index | Examples | Files | Directories

package uuid

import "4d63.com/uuid"

Package uuid exports typing for UUIDs. Sub-packages export functions for generating UUIDs of different types.

Code:

id, _ := uuid.Parse("08827178-0ad4-11e7-b5df-b3f54921aa61")

fmt.Println("String:", id.String())
fmt.Println("Timestamp:", id.Timestamp())

Output:

String: 08827178-0ad4-11e7-b5df-b3f54921aa61
Timestamp: 1290011724057047416

Index

Examples

Package Files

doc.go uuid.go

type UUID Uses

type UUID [16]byte

UUID is an implementation of the UUID RFC4122 standard. Ref: https://www.ietf.org/rfc/rfc4122.txt

func New Uses

func New(b [16]byte) UUID

New creates a UUID from a [16]byte.

func Parse Uses

func Parse(s string) (UUID, error)

Parse parses the hyphenated UUID string for a UUID.

func (UUID) String Uses

func (id UUID) String() string

String returns a text hyphenated hexadecimal representation of the UUID.

func (UUID) Timestamp Uses

func (id UUID) Timestamp() int64

Timestamp returns the integer value of the time portion of the UUID in 100ns intervals since Oct 15, 1582.

Note: All UUIDs have a time bits, but only TimeUUIDs (UUID v1) contain the time in these bits, making the return value of this function relatively useless for other UUIDs.

Directories

PathSynopsis
uuidv1Package uuidv1 exports functions for creating version 1 UUIDs, based on the current or a fixed time.

Package uuid imports 2 packages (graph) and is imported by 1 packages. Updated 2017-11-19. Refresh now. Tools for package owners.