Documentation ¶
Index ¶
- func AddComment(metadata *v0.Metadata, comment string) (*v0.Metadata, error)
- func ComputedUserset(relation string) *v0.SetOperation_Child
- func Exclusion(firstChild *v0.SetOperation_Child, rest ...*v0.SetOperation_Child) *v0.UsersetRewrite
- func FilterUserDefinedMetadata(nsconfig *v0.NamespaceDefinition) *v0.NamespaceDefinition
- func GetComments(metadata *v0.Metadata) []string
- func GetRelationKind(relation *v0.Relation) iv1.RelationMetadata_RelationKind
- func Intersection(firstChild *v0.SetOperation_Child, rest ...*v0.SetOperation_Child) *v0.UsersetRewrite
- func Namespace(name string, relations ...*v0.Relation) *v0.NamespaceDefinition
- func NamespaceWithComment(name string, comment string, relations ...*v0.Relation) *v0.NamespaceDefinition
- func Relation(name string, rewrite *v0.UsersetRewrite, ...) *v0.Relation
- func RelationReference(namespaceName string, relationName string) *v0.RelationReference
- func RelationWithComment(name string, comment string, rewrite *v0.UsersetRewrite, ...) *v0.Relation
- func Rewrite(rewrite *v0.UsersetRewrite) *v0.SetOperation_Child
- func SetRelationKind(relation *v0.Relation, kind iv1.RelationMetadata_RelationKind) error
- func This() *v0.SetOperation_Child
- func TupleToUserset(tuplesetRelation, usersetRelation string) *v0.SetOperation_Child
- func Union(firstChild *v0.SetOperation_Child, rest ...*v0.SetOperation_Child) *v0.UsersetRewrite
- type Mapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddComment ¶
AddComment adds a comment to the given metadata message.
func ComputedUserset ¶
func ComputedUserset(relation string) *v0.SetOperation_Child
ComputesUserset creates a child for a set operation that follows a relation on the given starting object.
func Exclusion ¶
func Exclusion(firstChild *v0.SetOperation_Child, rest ...*v0.SetOperation_Child) *v0.UsersetRewrite
Exclusion creates a rewrite definition that starts with the usersets of the first child and iteratively removes usersets that appear in the remaining children.
func FilterUserDefinedMetadata ¶ added in v0.0.2
func FilterUserDefinedMetadata(nsconfig *v0.NamespaceDefinition) *v0.NamespaceDefinition
FilterUserDefinedMetadata removes user-defined metadata (e.g. comments) from the given namespace.
func GetComments ¶
GetComments returns the comment metadata found within the given metadata message.
func GetRelationKind ¶
func GetRelationKind(relation *v0.Relation) iv1.RelationMetadata_RelationKind
GetRelationKind returns the kind of the relation.
func Intersection ¶
func Intersection(firstChild *v0.SetOperation_Child, rest ...*v0.SetOperation_Child) *v0.UsersetRewrite
Intersection creates a rewrite definition that returns/considers only usersets present in all children.
func Namespace ¶
func Namespace(name string, relations ...*v0.Relation) *v0.NamespaceDefinition
Namespace creates a namespace definition with one or more defined relations.
func NamespaceWithComment ¶
func NamespaceWithComment(name string, comment string, relations ...*v0.Relation) *v0.NamespaceDefinition
NamespaceWithComment creates a namespace definition with one or more defined relations.
func Relation ¶
func Relation(name string, rewrite *v0.UsersetRewrite, allowedDirectRelations ...*v0.RelationReference) *v0.Relation
Relation creates a relation definition with an optional rewrite definition.
func RelationReference ¶
func RelationReference(namespaceName string, relationName string) *v0.RelationReference
RelationReference creates a relation reference.
func RelationWithComment ¶
func RelationWithComment(name string, comment string, rewrite *v0.UsersetRewrite, allowedDirectRelations ...*v0.RelationReference) *v0.Relation
RelationWithComment creates a relation definition with an optional rewrite definition.
func Rewrite ¶
func Rewrite(rewrite *v0.UsersetRewrite) *v0.SetOperation_Child
Rewrite wraps a rewrite as a set operation child of another rewrite.
func SetRelationKind ¶
func SetRelationKind(relation *v0.Relation, kind iv1.RelationMetadata_RelationKind) error
SetRelationKind sets the kind of relation.
func This ¶
func This() *v0.SetOperation_Child
This creates a child for a set operation that references only direct usersets with the parent relation.
func TupleToUserset ¶
func TupleToUserset(tuplesetRelation, usersetRelation string) *v0.SetOperation_Child
TupleToUserset creates a child which first loads all tuples with the specific relation, and then unions all children on the usersets found by following a relation on those loaded tuples.
func Union ¶
func Union(firstChild *v0.SetOperation_Child, rest ...*v0.SetOperation_Child) *v0.UsersetRewrite
Union creates a rewrite definition that combines/considers usersets in all children.
Types ¶
type Mapper ¶ added in v0.0.2
type Mapper interface { // Encode translates a given namespace name to an encoded namespace identifier. Encode(name string) (string, error) // Reverse translates a given namespace identifier to the user supplied namespace name. Reverse(id string) (string, error) }
Mapper provides an interface for creating synthetic namespace names from user provided namespace names.
var PassthroughMapper Mapper = passthrough{}
PassthroughMapper is a mapper implementation which passes through the original namespace names unmodified.