Documentation
¶
Overview ¶
Package objectidtest builds deterministic object IDs for tests, so a test can name "the buyer" or "the seller" and get the same valid ID on every run:
buyer := objectidtest.FromSeed[fanType]("buyer")
The bare value is a UUIDv5 of the seed, so it passes ValidateUUID.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Namespace = uuid.NewSHA1(uuid.NameSpaceURL, []byte("https://github.com/TrogonStack/trogonobjectid/objectidtest"))
Namespace is the UUIDv5 namespace that FromSeed uses.
Functions ¶
func FromSeed ¶
func FromSeed[T trogonobjectid.Definer](seed string) trogonobjectid.ID[T]
FromSeed returns the ID whose bare value is the UUIDv5 of seed in Namespace. It panics if the type rejects the value, because a test fixture must be valid.
Example ¶
buyer := objectidtest.FromSeed[fanType]("buyer")
fmt.Println(buyer == objectidtest.FromSeed[fanType]("buyer"))
fmt.Println(buyer.Prefix())
Output: true fan_
func FromSeedIn ¶
func FromSeedIn[T trogonobjectid.Definer](namespace uuid.UUID, seed string) trogonobjectid.ID[T]
FromSeedIn is like FromSeed in another namespace, for matching IDs that another service's test helpers derive.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.