Skip to content
/ uuid Public
generated from pkg-id/go-pkg-template

UUID is a 128 bit (16 byte) Universal Unique Identifier as defined in RFC 4122.

License

Notifications You must be signed in to change notification settings

pkg-id/uuid

Repository files navigation

UUID

GoDoc Go Report Card

UUID is a 128 bit (16 byte) Universal Unique Identifier as defined in RFC 4122.

Installation

go get github.com/pkg-id/uuid

Usage

package main

import "github.com/pkg-id/uuid"

func main() {
	v4 := uuid.NewV4Generator(uuid.SecureReader)

	uid, err := v4.NewUUID()
	if err != nil {
		panic(err)
	}

	println(uid.String())
}

or use StaticReader for testing purposes:

package main

import "github.com/pkg-id/uuid"

func main() {
    v4 := uuid.NewV4Generator(uuid.StaticReader)

    uid, err := v4.NewUUID()
    if err != nil {
        panic(err)
    }

    println(uid.String() == uuid.StaticUUID) // true
}

License

MIT License. See LICENSE for details.

About

UUID is a 128 bit (16 byte) Universal Unique Identifier as defined in RFC 4122.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published