blob: 3a39cf9d1b2154e34594ddcf1289f8a0c7127fa4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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
ToObjectReference() *v1.ObjectReference
}
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()))
}
|