objectidtest

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL