ulid

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID ulid.ULID

ID is an alias of ulid.ULID.

func MustParse

func MustParse(s string) ID

MustParse alias ulid.MustParse. Panics if s is invalid.

func NewID

func NewID() ID

NewID returns a new random ID.

func NewIDs

func NewIDs(n int) []ID

NewIDs returns a new array of random IDs.

func NewPopulatedID

func NewPopulatedID(r randyID) *ID

NewPopulatedID only required if populate option is set

func NewTimeID

func NewTimeID(t uint64) ID

NewTimeID returns a new random ID based on time t.

func Parse

func Parse(s string) (ID, error)

Parse alias ulid.Parse. Panics if s is invalid.

func Zero

func Zero() ID

Zero returns a zero id.

func (ID) Bytes

func (id ID) Bytes() []byte

Bytes returns id as byte slice for protobuf marshaling.

func (ID) Compare

func (id ID) Compare(other ID) int

Compare only required if the compare option is set

func (ID) Equal

func (id ID) Equal(other ID) bool

Equal only required if the equal option is set

func (ID) IsZero

func (id ID) IsZero() bool

IsZero returns if id is zero.

func (ID) Marshal

func (id ID) Marshal() ([]byte, error)

Marshal never returns any error..

func (ID) MarshalJSON

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

MarshalJSON returns id in human readable string format.

func (ID) MarshalTo

func (id ID) MarshalTo(data []byte) (n int, err error)

MarshalTo never returns any error.

func (*ID) Size

func (id *ID) Size() int

Size always returns 16.

func (ID) String

func (id ID) String() string

String returns a human readable string ID.

func (ID) Time

func (id ID) Time() uint64

Time returns ms time of ID.

func (ID) Timestamp

func (id ID) Timestamp() uint64

Timestamp returns seconds time of ID.

func (*ID) Unmarshal

func (id *ID) Unmarshal(data []byte) error

Unmarshal never returns any error.

func (*ID) UnmarshalJSON

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

UnmarshalJSON unmarshals and valid data.

Jump to

Keyboard shortcuts

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