Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDuplicateGrant = errors.New("duplicate (subject, object, kind) in the batch")
ErrDuplicateGrant means a batch held two grants with the same (Subject, Object, Kind). The partial unique index allows one DIRECT role per grant, so the upsert touches a row twice and the DB rejects it; the handler maps this to InvalidArgument.
Functions ¶
This section is empty.
Types ¶
type Kind ¶
type Kind int32
Kind mirrors relationshipspb.Kind but keeps this package free of a proto dependency; the handler maps the proto enum onto it.
type Relationship ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func New ¶
func New(tx storage.Transaction) *Repository
func (*Repository) BatchUpsert ¶
func (r *Repository) BatchUpsert(ctx context.Context, grants []Grant) ([]Relationship, error)
BatchUpsert writes every grant in one statement and returns the stored rows in the same order as grants. A batch must not contain two grants with the same (Subject, Object, Kind); the DB rejects that and BatchUpsert returns ErrDuplicateGrant.
Click to show internal directories.
Click to hide internal directories.