Documentation ¶
Overview ¶
Package pulid implements the pulid type. A pulid is an identifier that is a two-byte prefixed ULIDs, with the first two bytes encoding the type of the entity.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type Annotation struct {
Prefix string
}
Annotation captures the id prefix for a type.
func (Annotation) Name ¶
func (a Annotation) Name() string
Name implements the fluent Annotation interface.
type ID ¶
type ID string
ID implements a PULID - a prefixed ULID.
func MustNew ¶
MustNew returns a new PULID for time.Now() given a prefix. This uses the default entropy source.
func (ID) MarshalGQL ¶
MarshalGQL implements the graphql.Marshaler interface
func (*ID) UnmarshalGQL ¶
UnmarshalGQL implements the graphql.Unmarshaler interface
type Mixin ¶
Mixin defines an fluent Mixin that captures the PULID prefix for a type.
func MixinWithPrefix ¶
MixinWithPrefix creates a Mixin that encodes the provided prefix.
func (Mixin) Annotations ¶
func (m Mixin) Annotations() []schema.Annotation
Annotations returns the annotations for a Mixin instance.