Skip to content

Latest commit

 

History

History
28 lines (16 loc) · 1.57 KB

README.md

File metadata and controls

28 lines (16 loc) · 1.57 KB

UUID

Licensed under: Boost Software License Current release Documentation

This package implements the UUID versions defined in RFC4122bis.

Versions 1 through 5 are defined in the original RFC4122, while versions 6 through 8 are new additions.

Versions 6 and 7 are designed as timestamp-based, sortable IDs for use e.g. in database indexes. Version 7 is recommended for new applications while version 6 is a sortable replacement for version 1.

Version 8 is highly customizable, allowing for 122 custom bits with only version and variant being predefined.

Create a new UUID: uuid.NewVx() (UUID, error)

Convert an UUID to a string: UUID.String() string

Convert a string to an UUID: uuid.Parse(string) (UUID, error)

Convert a byte slice to an UUID: uuid.ParseBytes([]byte) (UUID, error)

Check if UUID contains only zeros: UUID.IsNil() bool

Check if UUID contains only ones: UUID.IsMax() bool

Support for encoding.Text(Un)Marshaler, encoding.Binary(Un)Marshaler, database/sql.Scanner and database/sql/driver.Valuer is built in, so the IDs can be used with most data exchange formats and databases.