schema

package
v0.3.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(name string, child *base.Child) *base.ActionDefinition

Action - Action builder creates a new action definition with the given name and child entity

func Actions

func Actions(defs ...*base.ActionDefinition) []*base.ActionDefinition

Actions - Actions builder creates a slice of action definitions from the given variadic list of action definitions

func ComputedUserSet

func ComputedUserSet(relation string, exclusion bool) *base.Child

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 Entity

func Entity(name string, relations []*base.RelationDefinition, actions []*base.ActionDefinition) *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 Intersection

func Intersection(children ...*base.Child) *base.Child

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 Reference

func Reference(name string) *base.RelationReference

Reference - Reference builder

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 Schema

func Schema(entities ...*base.EntityDefinition) *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

func TupleToUserSet(reference, relation string, exclusion bool) *base.Child

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.

func Union

func Union(children ...*base.Child) *base.Child

Union takes a variable number of Child arguments and returns a new Child representing the union of all the sets obtained by evaluating each child.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL