Documentation ¶
Index ¶
- Constants
- func IsolationTest(t *testing.T, m0, m1 Manager)
- func ManagerTest(t *testing.T, m Manager)
- func MapAndWriteTuples(t *testing.T, m interface{ ... }, tuples ...*ketoapi.RelationTuple)
- func MappingManagerTest(t *testing.T, m MappingManager)
- func NewHandler(d handlerDeps) *handler
- type InternalRelationTuples
- type Manager
- type ManagerProvider
- type ManagerWrapper
- func (t *ManagerWrapper) DeleteAllRelationTuples(ctx context.Context, query *RelationQuery) error
- func (t *ManagerWrapper) DeleteRelationTuples(ctx context.Context, rs ...*RelationTuple) error
- func (t *ManagerWrapper) ExistsRelationTuples(ctx context.Context, query *RelationQuery) (bool, error)
- func (t *ManagerWrapper) GetRelationTuples(ctx context.Context, query *RelationQuery, options ...x.PaginationOptionSetter) ([]*RelationTuple, string, error)
- func (t *ManagerWrapper) RelationTupleManager() Manager
- func (t *ManagerWrapper) TransactRelationTuples(ctx context.Context, insert []*RelationTuple, delete []*RelationTuple) error
- func (t *ManagerWrapper) WriteRelationTuples(ctx context.Context, rs ...*RelationTuple) error
- type Mapper
- func (m *Mapper) FromQuery(ctx context.Context, apiQuery *ketoapi.RelationQuery) (res *RelationQuery, err error)
- func (m *Mapper) FromSubjectSet(ctx context.Context, set *ketoapi.SubjectSet) (_ *SubjectSet, err error)
- func (m *Mapper) FromTuple(ctx context.Context, ts ...*ketoapi.RelationTuple) (res []*RelationTuple, err error)
- func (m *Mapper) ToQuery(ctx context.Context, q *RelationQuery) (res *ketoapi.RelationQuery, err error)
- func (m *Mapper) ToTree(ctx context.Context, tree *Tree) (res *ketoapi.Tree[*ketoapi.RelationTuple], err error)
- func (m *Mapper) ToTuple(ctx context.Context, ts ...*RelationTuple) (res []*ketoapi.RelationTuple, err error)
- type MapperProvider
- type MappingManager
- type MappingManagerProvider
- type RelationQuery
- type RelationTuple
- type Subject
- type SubjectID
- type SubjectSet
- type Traversal
- type TraversalResult
- type Traverser
- type Tree
- type TupleData
Constants ¶
View Source
const ( ReadRouteBase = "/relation-tuples" WriteRouteBase = "/admin/relation-tuples" )
Variables ¶
This section is empty.
Functions ¶
func IsolationTest ¶
func ManagerTest ¶
func MapAndWriteTuples ¶
func MapAndWriteTuples(t *testing.T, m interface { MapperProvider ManagerProvider }, tuples ...*ketoapi.RelationTuple)
MapAndWriteTuples is a test helper to write relationships to the database while mapping all strings to UUIDs.
func MappingManagerTest ¶
func MappingManagerTest(t *testing.T, m MappingManager)
func NewHandler ¶
func NewHandler(d handlerDeps) *handler
Types ¶
type InternalRelationTuples ¶
type InternalRelationTuples []*RelationTuple
type Manager ¶
type Manager interface { GetRelationTuples(ctx context.Context, query *RelationQuery, options ...x.PaginationOptionSetter) ([]*RelationTuple, string, error) ExistsRelationTuples(ctx context.Context, query *RelationQuery) (bool, error) WriteRelationTuples(ctx context.Context, rs ...*RelationTuple) error DeleteRelationTuples(ctx context.Context, rs ...*RelationTuple) error DeleteAllRelationTuples(ctx context.Context, query *RelationQuery) error TransactRelationTuples(ctx context.Context, insert []*RelationTuple, delete []*RelationTuple) error }
type ManagerProvider ¶
type ManagerProvider interface {
RelationTupleManager() Manager
}
type ManagerWrapper ¶
type ManagerWrapper struct { Reg ManagerProvider PageOpts []x.PaginationOptionSetter RequestedPages []string // contains filtered or unexported fields }
func NewManagerWrapper ¶
func NewManagerWrapper(_ any, reg ManagerProvider, options ...x.PaginationOptionSetter) *ManagerWrapper
func (*ManagerWrapper) DeleteAllRelationTuples ¶
func (t *ManagerWrapper) DeleteAllRelationTuples(ctx context.Context, query *RelationQuery) error
func (*ManagerWrapper) DeleteRelationTuples ¶
func (t *ManagerWrapper) DeleteRelationTuples(ctx context.Context, rs ...*RelationTuple) error
func (*ManagerWrapper) ExistsRelationTuples ¶
func (t *ManagerWrapper) ExistsRelationTuples(ctx context.Context, query *RelationQuery) (bool, error)
func (*ManagerWrapper) GetRelationTuples ¶
func (t *ManagerWrapper) GetRelationTuples(ctx context.Context, query *RelationQuery, options ...x.PaginationOptionSetter) ([]*RelationTuple, string, error)
func (*ManagerWrapper) RelationTupleManager ¶
func (t *ManagerWrapper) RelationTupleManager() Manager
func (*ManagerWrapper) TransactRelationTuples ¶
func (t *ManagerWrapper) TransactRelationTuples(ctx context.Context, insert []*RelationTuple, delete []*RelationTuple) error
func (*ManagerWrapper) WriteRelationTuples ¶
func (t *ManagerWrapper) WriteRelationTuples(ctx context.Context, rs ...*RelationTuple) error
type Mapper ¶
type Mapper struct { D mapperDependencies ReadOnly bool }
func (*Mapper) FromQuery ¶
func (m *Mapper) FromQuery(ctx context.Context, apiQuery *ketoapi.RelationQuery) (res *RelationQuery, err error)
func (*Mapper) FromSubjectSet ¶
func (m *Mapper) FromSubjectSet(ctx context.Context, set *ketoapi.SubjectSet) (_ *SubjectSet, err error)
func (*Mapper) FromTuple ¶
func (m *Mapper) FromTuple(ctx context.Context, ts ...*ketoapi.RelationTuple) (res []*RelationTuple, err error)
func (*Mapper) ToQuery ¶
func (m *Mapper) ToQuery(ctx context.Context, q *RelationQuery) (res *ketoapi.RelationQuery, err error)
func (*Mapper) ToTuple ¶
func (m *Mapper) ToTuple(ctx context.Context, ts ...*RelationTuple) (res []*ketoapi.RelationTuple, err error)
type MapperProvider ¶
type MappingManager ¶
type MappingManagerProvider ¶
type MappingManagerProvider interface {
MappingManager() MappingManager
}
type RelationQuery ¶
type RelationTuple ¶
type RelationTuple struct { Namespace string `json:"namespace"` Object uuid.UUID `json:"object"` Relation string `json:"relation"` Subject Subject `json:"subject"` }
func (*RelationTuple) FromProto ¶
func (t *RelationTuple) FromProto(proto *rts.RelationTuple) *RelationTuple
func (*RelationTuple) String ¶
func (t *RelationTuple) String() string
func (*RelationTuple) ToProto ¶
func (t *RelationTuple) ToProto() *rts.RelationTuple
func (*RelationTuple) ToQuery ¶
func (t *RelationTuple) ToQuery() *RelationQuery
type SubjectSet ¶
type SubjectSet struct { Namespace string `json:"namespace"` Object uuid.UUID `json:"object"` Relation string `json:"relation"` }
func (*SubjectSet) Equals ¶
func (s *SubjectSet) Equals(other Subject) bool
func (*SubjectSet) String ¶
func (s *SubjectSet) String() string
func (*SubjectSet) UniqueID ¶
func (s *SubjectSet) UniqueID() uuid.UUID
type TraversalResult ¶
type TraversalResult struct { From *RelationTuple To *RelationTuple Via Traversal Found bool }
type Traverser ¶
type Traverser interface { TraverseSubjectSetExpansion(ctx context.Context, tuple *RelationTuple) ([]*TraversalResult, error) TraverseSubjectSetRewrite(ctx context.Context, tuple *RelationTuple, computedSubjectSets []string) ([]*TraversalResult, error) }
Click to show internal directories.
Click to hide internal directories.