ulid

package
v0.0.0-...-c99e9fc Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrInvalidULID

type ErrInvalidULID struct {
	Value any
}

func (ErrInvalidULID) Error

func (e ErrInvalidULID) Error() string

type ID

type ID []byte

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 NewZeroID

func NewZeroID() ID

NewZeroID returns a new zero ID.

func Parse

func Parse(s string) (ID, error)

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

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) Copy

func (id ID) Copy() ID

Copy returns a hard copy of bytes.

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 value or not.

func (ID) Marshal

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

Marshal never returns any error..

func (ID) MarshalCQL

func (id ID) MarshalCQL(info gocql.TypeInfo) ([]byte, error)

MarshalCQL override marshalling to fit CQL UUID.

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) ScanUUID

func (id *ID) ScanUUID(v pgtype.UUID) error

ScanUUID implements pgtype.UUIDScanner interface

func (*ID) Size

func (id *ID) Size() int

Size always returns length.

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) ULID

func (id ID) ULID() ulid.ULID

ULID returns original type.

func (ID) UUIDValue

func (id ID) UUIDValue() (pgtype.UUID, error)

UUIDValue implements pgtype.UUIDValuer interface

func (*ID) Unmarshal

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

Unmarshal never returns any error.

func (*ID) UnmarshalCQL

func (id *ID) UnmarshalCQL(info gocql.TypeInfo, data []byte) error

UnmarshalCQL override unmarshalling to fit CQL UUID.

func (*ID) UnmarshalJSON

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

UnmarshalJSON unmarshals and valid data.

type IDs

type IDs []ID

func (IDs) Any

func (ids IDs) Any() []any

func (IDs) String

func (ids IDs) String() []string

Jump to

Keyboard shortcuts

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