Documentation
¶
Overview ¶
Package idgen defines an ID type, and the IDGen type, which can be used to generate IDs. It also defines several IDGen implementations.
Index ¶
Constants ¶
View Source
const NilID = ID("")
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IDGen ¶
IDGen is a function that generates either an ID or an error
func NewCounter ¶
NewCounter produces an IDGen which will produce IDs derived from a counter, offset from the given start value. Each call to the function will atomically increment the underlyinc counter. This IDGen should only be used for testing, when predictable ID values are needed.
func NewPrefixing ¶
NewPrefixing produces an IDGen which will apply the given prefix string to IDs generated by the given IDGen
Click to show internal directories.
Click to hide internal directories.