summaryrefslogtreecommitdiff
path: root/app/domain/identifiable.go
blob: 190f20cbb1ad5a8df6d5aee11cabcb7ba14333d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package domain

import (
	v1 "github.com/authzed/authzed-go/proto/authzed/api/v1"
	"github.com/xlgmokha/x/pkg/x"
)

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) {
		item.SetID(id)
	}
}