guid

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2016 License: MIT Imports: 3 Imported by: 38

README

Guid

Globally unique identifiers offer a quick means of generating non-colliding values across a distributed system. For this implemenation, RFC 4122 governs the desired behavior.

What's in a name?

You have likely already noticed that RFC and some implementations refer to these structures as UUIDs (Universally Unique Identifiers), where as this project is annotated as GUIDs (Globally Unique Identifiers). The name Guid was selected to make clear this project's ties to the .NET struct Guid. The most obvious relationship is the desire to have the same format specifiers available in this library's Format and Parse methods as .NET would have in its ToString and Parse methods.

Versioning

This library will adhere to the Semantic Versioning 2.0.0 specification. It may be worth noting this should allow for tools like glide to pull in this library with ease.

The Release Notes portion of this file will be updated to reflect the most recent major/minor updates, with the option to tag particular bug-fixes as well. Updates to the Release Notes for patches should be addative, where as minor/major updates should replace the previous version. If one desires to see the release notes for an older version, checkout that version of code and open this file.

Release Notes 0.1.*

0.1.1

For this release, basic functionality (instantiate, parse, and format) have been added. The only means of generating Guids is "version4" from RFC4122. Less formally, this is the version that generates a random GUID, with only 6 bits that are not random.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GUID

type GUID struct {
	// contains filtered or unexported fields
}

GUID is a unique identifier designed to virtually guarantee non-conflict between values generated across a distributed system. This allows for values that are

func Empty

func Empty() GUID

Empty returns a copy of the default and empty GUID.

func NewGUID

func NewGUID() GUID

NewGUID generates and returns a new globally unique identifier

func Parse

func Parse(value string) (GUID, error)

Parse instantiates a GUID from a text represention of the same GUID. This is the inverse function of String()

func (*GUID) Format

func (guid *GUID) Format(format string) (string, error)

Format returns a text representation of a GUID that conforms to the specified format.

func (*GUID) String

func (guid *GUID) String() string

func (*GUID) Version

func (guid *GUID) Version() uint

Version reads a GUID to parse which mechanism of generating GUIDS was employed. Values returned here are documented in rfc4122.txt.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL