uid
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package uid supports generating unique IDs. Its chief purpose is to preventmultiple test executions from interfering with each other, and to facilitatecleanup of old entities that may remain if tests exit early.
Index¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeOptions¶
type Options struct {Seprune// Separates parts of the UID. Defaults to '-'.Timetime.Time// Timestamp for all UIDs made with this space. Defaults to current time.// Short, if true, makes the result of space.New shorter by 6 characters.// This can be useful for character restricted IDs. It will use a shorter// but less readable time representation, and will only use two characters// for the count suffix instead of four.//// e.x. normal: gotest-20181030-59751273685000-0001// e.x. short: gotest-1540917351273685000-01Shortbool}Options are optional values for a Space.
typeSpace¶
type Space struct {Prefixstring// Prefix of UIDs. Read-only.Seprune// Separates UID parts. Read-only.Timetime.Time// Timestamp for UIDs. Read-only.// contains filtered or unexported fields}A Space manages a set of unique IDs distinguished by a prefix.
func (*Space)New¶
New generates a new unique ID. The ID consists of the Space's prefix, atimestamp, and a counter value. All unique IDs generated in the same testexecution will have the same timestamp.
Aside from the characters in the prefix, IDs contain only letters, numbersand sep.