uuid

package
v0.0.0-...-ae58740 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package uuid encodes and decodes UUIDs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Firefox

type Firefox struct {
	ID   string // e.g. "addon@example.com"
	UUID *UUID  // e.g. "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"
}

Firefox is an ID or UUID and is used by Firefox addons. ID is preferred for display.

func (Firefox) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface.

func (Firefox) MarshalText

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

MarshalText implements the encoding.TextMarshaler interface.

func (Firefox) String

func (id Firefox) String() string

func (*Firefox) UnmarshalJSON

func (id *Firefox) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Firefox) UnmarshalText

func (id *Firefox) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type Format

type Format uint8

Format is a UUID formatting style.

const (
	Normal Format = iota // "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
	Braced               // "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"
)

UUID formats:

type UUID

type UUID [16]byte

UUID is a UUID that is formatted as "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" or "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}".

func Decode

func Decode(uuid []byte) (*UUID, error)

Decode decodes a UUID.

func (*UUID) Encode

func (uuid *UUID) Encode(format Format) []byte

Encode encodes a UUID in the given format.

func (*UUID) MarshalJSON

func (uuid *UUID) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*UUID) MarshalText

func (uuid *UUID) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*UUID) String

func (uuid *UUID) String() string

func (*UUID) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaler interface.

func (*UUID) UnmarshalText

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

Jump to

Keyboard shortcuts

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