diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-24 15:38:36 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-24 15:38:36 -0600 |
| commit | 7fb5255aafc435f5b47725716963f3aebfb9feb2 (patch) | |
| tree | 2779faa2ce03296013722086019262bbc390cadf /app/domain/identifiable.go | |
| parent | 5f04ff8b3051d176dca586357ed68482d62b8eef (diff) | |
test: Validate Entity ObjectReference
Diffstat (limited to 'app/domain/identifiable.go')
| -rw-r--r-- | app/domain/identifiable.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/domain/identifiable.go b/app/domain/identifiable.go index 190f20c..3a39cf9 100644 --- a/app/domain/identifiable.go +++ b/app/domain/identifiable.go @@ -3,17 +3,21 @@ package domain import ( v1 "github.com/authzed/authzed-go/proto/authzed/api/v1" "github.com/xlgmokha/x/pkg/x" + "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/pls" ) type Identifiable interface { GetID() ID SetID(id ID) error - ToGID() string ToObjectReference() *v1.ObjectReference } -func WithID[T Identifiable](id ID) x.Configure[T] { - return func(item T) { +func WithID[T Identifiable](id ID) x.Option[T] { + return x.With(func(item T) { item.SetID(id) - } + }) +} + +func WithULID[T Identifiable]() x.Option[T] { + return WithID[T](ID(pls.GenerateULID())) } |
