blob: 005c98cdc1b2f7e35158f40dae91463d3b0ddbf2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package domain
import (
"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() GlobalID
}
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()))
}
|