Documentation
¶
Index ¶
- Constants
- type ID
- func (id *ID) Bytes() (out []byte)
- func (id *ID) Index() (idx uint64, err error)
- func (id *ID) IsEmpty() (empty bool)
- func (id *ID) MarshalJSON() (out []byte, err error)
- func (id *ID) String() (out string)
- func (id *ID) Time() (t time.Time, err error)
- func (id *ID) UnmarshalJSON(in []byte) (err error)
- type ID32
- func (id *ID32) Bytes() (out []byte)
- func (id *ID32) Index() (idx uint32, err error)
- func (id *ID32) IsEmpty() (empty bool)
- func (id *ID32) MarshalJSON() (out []byte, err error)
- func (id *ID32) String() (out string)
- func (id *ID32) Time() (t time.Time, err error)
- func (id *ID32) UnmarshalJSON(in []byte) (err error)
- type IDG
- type PIDG
- type TIDG
Constants ¶
const ErrEmptyID = errors.Error("cannot perform action on nil ID")
ErrEmptyID is returned when an action is performed on a nil instance of ID
const ( // ErrInvalidLength is returned when an ID is not 16 bytes in length ErrInvalidLength = errors.Error("invalid length") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ID ¶
type ID [16]byte
ID represents an id
func (*ID) Bytes ¶
Bytes will return the byteslice representation Note: This function is unsafe and can change the underlying array Please.. read only!
func (*ID) MarshalJSON ¶
MarshalJSON is a JSON encoding helper func
func (*ID) String ¶
String will return a string representation Note: This is referenced as a non-pointer so it can be called directly from a struct utilizing the non-pointer value of ID
func (*ID) UnmarshalJSON ¶
UnmarshalJSON is a JSON decoding helper func
type ID32 ¶
type ID32 [8]byte
ID32 represents a 32-bit id
func (*ID32) Bytes ¶
Bytes will return the byteslice representation Note: This function is unsafe and can change the underlying array Please.. read only!
func (*ID32) MarshalJSON ¶
MarshalJSON is a JSON encoding helper func
func (*ID32) String ¶
String will return a string representation Note: This is referenced as a non-pointer so it can be called directly from a struct utilizing the non-pointer value of ID
func (*ID32) UnmarshalJSON ¶
UnmarshalJSON is a JSON decoding helper func
type IDG ¶
type IDG struct {
// contains filtered or unexported fields
}
IDG is an non-persistent atomic ID generator
type PIDG ¶
type PIDG struct {
// contains filtered or unexported fields
}
PIDG is an non-persistent atomic ID generator
func NewPersistent ¶
NewPersistent will return a new ID generator