Documentation ¶
Index ¶
- Variables
- func CheckIDMatch(id, target ulid.ULID) error
- func IsZero(uid ulid.ULID) bool
- func MustParse(uid any) (id ulid.ULID)
- func New() ulid.ULID
- func Parse(uid any) (ulid.ULID, error)
- type NullULID
- func (nu NullULID) MarshalBinary() ([]byte, error)
- func (nu *NullULID) MarshalJSON() ([]byte, error)
- func (nu *NullULID) MarshalText() ([]byte, error)
- func (nu *NullULID) Scan(value interface{}) error
- func (nu *NullULID) UnmarshalBinary(data []byte) error
- func (nu *NullULID) UnmarshalJSON(data []byte) error
- func (nu *NullULID) UnmarshalText(data []byte) error
- func (nu NullULID) Value() (driver.Value, error)
- type PoolEntropy
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnknownType = errors.New("cannot parse ulid input: unknown type") ErrMissingID = errors.New("id required for this resource") ErrIDMismatch = errors.New("resource id does not match target") )
var Null = ulid.ULID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
Null ULID pre-allocated for easier checking.
Functions ¶
func CheckIDMatch ¶
func CheckIDMatch(id, target ulid.ULID) error
CheckIDMatch returns an error if the id is Null or it does not match the target.
func IsZero ¶
func IsZero(uid ulid.ULID) bool
Determines if the specified uid is the Null or zero-valued ULID. Useful for determining if a ULID has been passed into a method or is valid.
func MustParse ¶
func MustParse(uid any) (id ulid.ULID)
MustParse parses the ULID but panics on errors.
func New ¶
func New() ulid.ULID
New creates a new montonically increasing ULID in a threadsafe manner using a cryptographically random source of entropy for security (e.g. to ensure that an attacker cannot guess the next ULID to be generated). If the ULID cannot be generated this method panics rather than returning an error.
Types ¶
type NullULID ¶
type NullULID struct { ULID ulid.ULID Valid bool }
func (NullULID) MarshalBinary ¶
func (*NullULID) MarshalJSON ¶
func (*NullULID) MarshalText ¶
func (*NullULID) UnmarshalBinary ¶
func (*NullULID) UnmarshalJSON ¶
func (*NullULID) UnmarshalText ¶
type PoolEntropy ¶
PoolEntropy is a thread-safe source of entropy that is not cryptographically secure but provides fast, concurrent access to random data generation.
func NewPool ¶
func NewPool() *PoolEntropy