Documentation ¶
Index ¶
- func Attribute(name string, typ base.AttributeType) *base.AttributeDefinition
- func Attributes(defs ...*base.AttributeDefinition) []*base.AttributeDefinition
- func Call(name string, arguments ...*base.Argument) *base.Child
- func ComputedAttribute(name string) *base.Child
- func ComputedUserSet(relation string) *base.Child
- func Entities(defs ...*base.EntityDefinition) []*base.EntityDefinition
- func Entity(name string, relations []*base.RelationDefinition, ...) *base.EntityDefinition
- func Exclusion(children ...*base.Child) *base.Child
- func Intersection(children ...*base.Child) *base.Child
- func Permission(name string, child *base.Child) *base.PermissionDefinition
- func Permissions(defs ...*base.PermissionDefinition) []*base.PermissionDefinition
- func Reference(name string) *base.RelationReference
- func Relation(name string, references ...*base.RelationReference) *base.RelationDefinition
- func Relations(defs ...*base.RelationDefinition) []*base.RelationDefinition
- func Rule(name string, arguments map[string]base.AttributeType, expression string) *base.RuleDefinition
- func Rules(defs ...*base.RuleDefinition) []*base.RuleDefinition
- func Schema(entities []*base.EntityDefinition, rules []*base.RuleDefinition) *base.SchemaDefinition
- func TupleToUserSet(reference, relation string) *base.Child
- func Union(children ...*base.Child) *base.Child
- type Loader
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attribute ¶ added in v0.5.0
func Attribute(name string, typ base.AttributeType) *base.AttributeDefinition
Attribute is a function that generates an attribute definition given a name and an attribute type.
func Attributes ¶ added in v0.5.0
func Attributes(defs ...*base.AttributeDefinition) []*base.AttributeDefinition
Attributes - Attributes builder
func Call ¶ added in v0.5.0
Call is a function that generates a child definition for a call given its name and a list of arguments.
func ComputedAttribute ¶ added in v0.5.0
ComputedAttribute is a function that generates a child definition for a computed attribute given its name.
func ComputedUserSet ¶
ComputedUserSet - returns a Child definition that represents a computed set of users based on a relation relation: the name of the relation on which the computed set is based exclusion: a boolean indicating if the computed set should exclude or include the users in the set
func Entities ¶ added in v0.5.0
func Entities(defs ...*base.EntityDefinition) []*base.EntityDefinition
Entities - Entities builder
func Entity ¶
func Entity(name string, relations []*base.RelationDefinition, attributes []*base.AttributeDefinition, permissions []*base.PermissionDefinition) *base.EntityDefinition
Entity - Entity builder This function creates and returns a new instance of EntityDefinition. It takes in the name of the entity, an array of relations, and an array of actions. It then initializes the EntityDefinition with the provided values and returns it. The EntityDefinition contains information about the entity's name, its relations, actions, and references.
func Exclusion ¶ added in v0.4.2
Exclusion - Returns a child element that represents the exclusion of the given children. This child element can be used in defining entity relations and actions.
func Intersection ¶
Intersection - Returns a child element that represents the intersection of the given children. This child element can be used in defining entity relations and actions.
func Permission ¶ added in v0.3.9
func Permission(name string, child *base.Child) *base.PermissionDefinition
Permission - Permission builder creates a new action definition with the given name and child entity
func Permissions ¶ added in v0.3.9
func Permissions(defs ...*base.PermissionDefinition) []*base.PermissionDefinition
Permissions - Permissions builder creates a slice of action definitions from the given variadic list of action definitions
func Relation ¶
func Relation(name string, references ...*base.RelationReference) *base.RelationDefinition
Relation - Relation builder function that creates a new RelationDefinition instance with the given name and references.
Parameters: - name: a string representing the name of the relation. - references: a variadic parameter representing the relation references associated with this relation.
Returns: - a pointer to a new RelationDefinition instance with the given name and references.
func Relations ¶
func Relations(defs ...*base.RelationDefinition) []*base.RelationDefinition
Relations - Relations builder
func Rule ¶ added in v0.5.0
func Rule(name string, arguments map[string]base.AttributeType, expression string) *base.RuleDefinition
Rule is a function that generates a rule definition given a name, a map of argument names to attribute types, and an expression string. The expression string is compiled and transformed to a checked expression.
func Rules ¶ added in v0.5.0
func Rules(defs ...*base.RuleDefinition) []*base.RuleDefinition
Rules - Rules builder
func Schema ¶
func Schema(entities []*base.EntityDefinition, rules []*base.RuleDefinition) *base.SchemaDefinition
Schema is a function that returns a pointer to a SchemaDefinition structure. It takes a variable number of pointers to EntityDefinition structures as input arguments, which are added to the schema being constructed. The function creates a new SchemaDefinition structure, initializes its EntityDefinitions field to an empty map, and then adds each input EntityDefinition structure to this map with the entity name as the key. Finally, it returns the pointer to the constructed SchemaDefinition structure.
func TupleToUserSet ¶
TupleToUserSet - Returns a pointer to a base.Child struct, containing a Leaf struct with a TupleToUserSet struct, that represents a child computation where the tuple set is passed to the computed user set. Takes a reference string, relation string, and exclusion boolean as arguments. reference: the name of the reference to the tuple set relation: the name of the relation for the computed user set exclusion: a boolean indicating whether to exclude the computed user set Returns a pointer to a base.Child struct.
Types ¶
type Loader ¶ added in v0.5.9
type Loader struct {
// contains filtered or unexported fields
}
Loader is a struct that holds a map of loader functions, each corresponding to a Type.
func NewSchemaLoader ¶ added in v0.5.9
func NewSchemaLoader() *Loader
NewSchemaLoader initializes and returns a new Loader instance. It sets up the map of loader functions for each Type.