globalid

package
v0.0.0-...-4fdfd55 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2019 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Nil = ID("")

Functions

func Validate

func Validate(s string) error

Validate checks if the given string is a valid UUID v4 and returns the error otherwise.

Types

type Fixture

type Fixture struct {
	// contains filtered or unexported fields
}

func NewFixture

func NewFixture() *Fixture

func (*Fixture) Fixed

func (f *Fixture) Fixed(i int) ID

func (*Fixture) Next

func (f *Fixture) Next() ID

type ID

type ID string

func Next

func Next() ID

Generates a global identifier using pseudo-random numbers.

func Parse

func Parse(s string) (ID, error)

Parses a given string to ID given that it is a valid UUID v4.

func (ID) Bytes

func (id ID) Bytes() []byte

Bytes returns bytes slice representation of the global identifier.

func (ID) Index

func (id ID) Index() ID

Index allows globalid to implement queue.Indexable

func (ID) MarshalGQL

func (id ID) MarshalGQL(w io.Writer)

nolint: errcheck, gas

func (ID) MarshalJSON

func (id ID) MarshalJSON() (text []byte, err error)

MarshalJSON returns the byte representation of the global identifier enclosed in double quotes to form valid JSON.

func (ID) MarshalText

func (id ID) MarshalText() (text []byte, err error)

func (*ID) Scan

func (id *ID) Scan(src interface{}) error

func (ID) String

func (id ID) String() string

Returns canonical string representation of the global identifier. Example: 123e4567-e89b-12d3-a456-426655440000.

func (*ID) UnmarshalGQL

func (id *ID) UnmarshalGQL(v interface{}) error

func (*ID) UnmarshalJSON

func (id *ID) UnmarshalJSON(b []byte) error

UnmarshalJSON is based on the underlying UnmarshalText implementation.

func (*ID) UnmarshalText

func (id *ID) UnmarshalText(text []byte) (err error)

func (ID) Valid

func (id ID) Valid() bool

Valid returns true if the given string is a valid UUID v4.

func (ID) Value

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

type IDs

type IDs []ID

func (*IDs) Scan

func (ids *IDs) Scan(src interface{}) error

func (IDs) Value

func (ids IDs) Value() (driver.Value, error)

type Tuple

type Tuple struct {
	A ID
	B ID
}

Jump to

Keyboard shortcuts

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