uuid

package module
v0.0.0-...-e4fd26b Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: ISC Imports: 9 Imported by: 4

README

go-uuid

Introduction

The go-uuid library contains utilities to manipulate UUID unique identifiers as defined by RFC 4122bis (draft-ietf-uuidrev-rfc4122bis).

It currently supports UUID v4 and v7.

Usage

Refer to the Go package documentation for information about the API.

See the uuid program for a practical use case.

Licensing

Go-uuid is open source software distributed under the ISC license.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Nil = UUID{}
	Max = UUID{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
		0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
)
View Source
var (
	ErrInvalidFormat      = errors.New("invalid uuid format")
	ErrUnsupportedVersion = errors.New("unsupported uuid version")
)

Functions

This section is empty.

Types

type UUID

type UUID [16]byte

func Generate

func Generate(v Version) (UUID, error)

func GenerateV7Zero

func GenerateV7Zero(t time.Time) UUID

func MustGenerate

func MustGenerate(v Version) (id UUID)

func MustParse

func MustParse(s string) (id UUID)

func (UUID) Bytes

func (id UUID) Bytes() []byte

func (UUID) Equal

func (id1 UUID) Equal(id2 UUID) bool

func (*UUID) Generate

func (pId *UUID) Generate(v Version) error

func (*UUID) GenerateV7Zero

func (id *UUID) GenerateV7Zero(t time.Time)

func (UUID) IsNil

func (id UUID) IsNil() bool

func (UUID) MarshalJSON

func (id UUID) MarshalJSON() ([]byte, error)

json.Marshaler

func (UUID) MarshalText

func (id UUID) MarshalText() ([]byte, error)

encoding.TextMarshaler

func (*UUID) Parse

func (pId *UUID) Parse(s string) error

func (*UUID) Scan

func (id *UUID) Scan(value interface{}) error

database/sql.Scanner

func (UUID) String

func (id UUID) String() string

func (*UUID) UnmarshalJSON

func (pId *UUID) UnmarshalJSON(data []byte) error

json.Unmarshaler

func (*UUID) UnmarshalText

func (pId *UUID) UnmarshalText(data []byte) error

encoding.TextUnmarshaler

func (UUID) V7Time

func (id UUID) V7Time() time.Time

func (UUID) Value

func (id UUID) Value() (driver.Value, error)

database/sql/driver.Valuer

type Version

type Version int
const (
	V1 Version = 1
	V3 Version = 3
	V4 Version = 4
	V5 Version = 5
	V6 Version = 6
	V7 Version = 7
	V8 Version = 8
)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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