Documentation
¶
Index ¶
- func Compare(a, b XTID) int
- func IDGen(typ uint16) func() XTID
- func SetSource(src io.Reader)
- type XTID
- func FromBytes(b []byte) (XTID, error)
- func FromBytesOrNil(b []byte) XTID
- func Make(t time.Time, typ uint16) (id XTID, err error)
- func Must(id XTID, err error) XTID
- func NewOrNil() (id XTID)
- func NewWithType(typ uint16) (id XTID, err error)
- func Parse(s string) (XTID, error)
- func ParseOrNil(s string) XTID
- func (i XTID) Append(b []byte) []byte
- func (i XTID) Bytes() []byte
- func (i XTID) Get() any
- func (i XTID) IsNil() bool
- func (i XTID) MarshalBinary() ([]byte, error)
- func (i XTID) MarshalGQL(w io.Writer)
- func (i XTID) MarshalJSON() ([]byte, error)
- func (i XTID) MarshalText() ([]byte, error)
- func (i *XTID) Scan(src any) error
- func (i *XTID) Set(s string) error
- func (i XTID) String() string
- func (i XTID) Time() time.Time
- func (i XTID) Timestamp() uint64
- func (i XTID) Type() uint16
- func (i *XTID) UnmarshalBinary(b []byte) error
- func (i *XTID) UnmarshalGQL(v any) error
- func (i *XTID) UnmarshalJSON(v []byte) error
- func (i *XTID) UnmarshalText(b []byte) error
- func (i XTID) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type XTID ¶
type XTID [byteLength]byte
XTIDs are 20 bytes:
00-07 byte: uint64 timestamp 08~11 byte: uint32 type 12-19 byte: random "payload"
func FromBytesOrNil ¶
Constructs a XTID from a 20-byte binary representation. Same behavior as FromBytes, but returns a Nil XTID on error.
func NewWithType ¶
func ParseOrNil ¶
Parse decodes a string-encoded representation of a XTID object. Same behavior as Parse, but returns a Nil XTID on error.
func (XTID) Append ¶
Append appends the string representation of i to b, returning a slice to a potentially larger memory area.
func (XTID) Get ¶
Get satisfies the flag.Getter interface, making it possible to use XTIDs as part of of the command line options of a program.
func (XTID) MarshalBinary ¶
func (XTID) MarshalGQL ¶
MarshalGQL implements the graphql.Marshaler interface
func (XTID) MarshalJSON ¶
func (XTID) MarshalText ¶
func (*XTID) Scan ¶
Scan implements the sql.Scanner interface. It supports converting from string, []byte, or nil into a XTID value. Attempting to convert from another type will return an error.
func (*XTID) Set ¶
Set satisfies the flag.Value interface, making it possible to use XTIDs as part of of the command line options of a program.
func (XTID) Timestamp ¶
The timestamp portion of the ID as a bare integer which is uncorrected for XTID's special epoch.
func (*XTID) UnmarshalBinary ¶
func (*XTID) UnmarshalGQL ¶
UnmarshalGQL implements the graphql.UnMarshaler interface