uuid

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Nil = UUID(guuid.Nil)

Empty UUID, all zeros

Functions

This section is empty.

Types

type UUID

type UUID guuid.UUID

func FromBytes added in v0.8.0

func FromBytes(b []byte) (UUID, error)

FromBytes creates a new UUID from a byte slice. Returns an error if the slice does not have a length of 16. The bytes are copied from the slice.

func New added in v0.19.0

func New() UUID

New creates a new random UUID or panics.

func OfflinePlayerUUID added in v0.10.0

func OfflinePlayerUUID(username string) UUID

func Parse

func Parse(s string) (UUID, error)

Parse decodes s into a UUID or returns an error. Both the standard UUID forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.

func ParseBytes added in v0.8.0

func ParseBytes(b []byte) (UUID, error)

ParseBytes is like Parse, except it parses a byte slice instead of a string.

func (UUID) MarshalJSON added in v0.14.0

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

func (UUID) String

func (i UUID) String() string

String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx , or "" if uuid is invalid.

func (UUID) Undashed

func (i UUID) Undashed() string

Undashed returns the undashed string form of the uuid.

Jump to

Keyboard shortcuts

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