pulid

package
v0.0.0-...-8b6722b Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const PrefixLength = 3

Separator between prefix and the ULID.

View Source
const Separator = '_'

Variables

View Source
var ErrIncorrectPULIDFormat = fmt.Errorf("pulid: incorrect format")

ErrIncorrectPULIDFormat is returned when the PULID is not in the correct format.

Functions

func IsAPULID

func IsAPULID(pulid PULID) error

IsAPULID checks if this is a valid PULID.

func ParsePULID

func ParsePULID(pulid PULID) (string, string, error)

ParsePULID returns the prefix and ULID from a PULID.

Types

type PULID

type PULID string

Prefixed ULID with object type - globally universal ID.

func NewPULID

func NewPULID(prefix string) PULID

Creates a new PULID.

func (PULID) MarshalGQL

func (pulid PULID) MarshalGQL(w io.Writer)

Marshals a PULID into a graphql scalar string.

func (*PULID) Scan

func (pulid *PULID) Scan(src interface{}) error

Scans a database value to a PULID Go type.

func (PULID) String

func (pulid PULID) String() string

Returns a PULID value as a string.

func (*PULID) UnmarshalGQL

func (pulid *PULID) UnmarshalGQL(v interface{}) error

Unmarshals a graphql scalar into a PULID Go type.

func (PULID) Value

func (pulid PULID) Value() (driver.Value, error)

Transforms a PULID type to database value string.

Jump to

Keyboard shortcuts

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