diff options
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())) } |
