schema

package
v0.3.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetActionByNameInEntityDefinition

func GetActionByNameInEntityDefinition(entityDefinition *base.EntityDefinition, name string) (actionDefinition *base.ActionDefinition, err error)

GetActionByNameInEntityDefinition -

func GetEntityByName

func GetEntityByName(schema *base.SchemaDefinition, name string) (entityDefinition *base.EntityDefinition, err error)

GetEntityByName -

func GetRelationByNameInEntityDefinition

func GetRelationByNameInEntityDefinition(entityDefinition *base.EntityDefinition, name string) (relationDefinition *base.RelationDefinition, err error)

GetRelationByNameInEntityDefinition -

func GetTypeOfRelationalReferenceByNameInEntityDefinition

func GetTypeOfRelationalReferenceByNameInEntityDefinition(entityDefinition *base.EntityDefinition, name string) (relationalDefinitionType base.EntityDefinition_RelationalReference, err error)

GetTypeOfRelationalReferenceByNameInEntityDefinition -

func IsDirectlyRelated added in v0.3.5

func IsDirectlyRelated(targetRelation *base.RelationDefinition, source *base.RelationReference) bool

IsDirectlyRelated -

func NewEntityDefinitionsFromStringDefinitions

func NewEntityDefinitionsFromStringDefinitions(validation bool, definitions ...string) ([]*base.EntityDefinition, error)

NewEntityDefinitionsFromStringDefinitions -

func NewSchemaFromEntityDefinitions

func NewSchemaFromEntityDefinitions(entities ...*base.EntityDefinition) *base.SchemaDefinition

NewSchemaFromEntityDefinitions -

func NewSchemaFromStringDefinitions

func NewSchemaFromStringDefinitions(validation bool, definitions ...string) (*base.SchemaDefinition, error)

NewSchemaFromStringDefinitions -

Types

type LinkedEntrance added in v0.3.5

type LinkedEntrance struct {
	Kind             LinkedEntranceKind
	LinkedEntrance   *base.RelationReference
	TupleSetRelation *base.RelationReference
}

LinkedEntrance represents an entry point into the LinkedSchemaGraph, which is used to resolve permissions and expand user sets for a given request. The object contains a kind that specifies the type of entry point (e.g. relation, tuple-to-user-set), an entry point reference that identifies the specific entry point in the graph, and a tuple set relation reference that specifies the relation to use when expanding user sets for the entry point.

Fields:

  • Kind: LinkedEntranceKind representing the type of entry point
  • LinkedEntrance: pointer to a base.RelationReference that identifies the entry point in the schema graph
  • TupleSetRelation: pointer to a base.RelationReference that specifies the relation to use when expanding user sets for the entry point

func (LinkedEntrance) LinkedEntranceKind added in v0.3.5

func (re LinkedEntrance) LinkedEntranceKind() LinkedEntranceKind

LinkedEntranceKind returns the kind of the LinkedEntrance object. The kind specifies the type of entry point (e.g. relation, tuple-to-user-set, computed user set).

Returns:

  • LinkedEntranceKind representing the type of entry point

type LinkedEntranceKind added in v0.3.5

type LinkedEntranceKind string

LinkedEntranceKind is a string type that represents the kind of LinkedEntrance object. An LinkedEntrance object defines an entry point into the LinkedSchemaGraph, which is used to resolve permissions and expand user sets for a given request.

Values:

  • RelationLinkedEntrance: represents an entry point into a relationship object in the schema graph
  • TupleToUserSetLinkedEntrance: represents an entry point into a tuple-to-user-set object in the schema graph
  • ComputedUserSetLinkedEntrance: represents an entry point into a computed user set object in the schema graph
const (
	RelationLinkedEntrance        LinkedEntranceKind = "relation"
	TupleToUserSetLinkedEntrance  LinkedEntranceKind = "tuple_to_user_set"
	ComputedUserSetLinkedEntrance LinkedEntranceKind = "computed_user_set"
)

type LinkedSchemaGraph added in v0.3.5

type LinkedSchemaGraph struct {
	// contains filtered or unexported fields
}

LinkedSchemaGraph represents a graph of linked schema objects. The schema object contains definitions for entities, relationships, and permissions, and the graph is constructed by linking objects together based on their dependencies. The graph is used by the PermissionEngine to resolve permissions and expand user sets for a given request.

Fields:

  • schema: pointer to the base.SchemaDefinition that defines the schema objects in the graph

func NewLinkedGraph added in v0.3.5

func NewLinkedGraph(schema *base.SchemaDefinition) *LinkedSchemaGraph

NewLinkedGraph returns a new instance of LinkedSchemaGraph with the specified base.SchemaDefinition as its schema. The schema object contains definitions for entities, relationships, and permissions, and is used to construct a graph of linked schema objects. The graph is used by the PermissionEngine to resolve permissions and expand user sets for a given request.

Parameters:

  • schema: pointer to the base.SchemaDefinition that defines the schema objects in the graph

Returns:

  • pointer to a new instance of LinkedSchemaGraph with the specified schema object

func (*LinkedSchemaGraph) RelationshipLinkedEntrances added in v0.3.5

func (g *LinkedSchemaGraph) RelationshipLinkedEntrances(target, source *base.RelationReference) ([]LinkedEntrance, error)

RelationshipLinkedEntrances returns a slice of LinkedEntrance objects that represent entry points into the LinkedSchemaGraph for the specified target and source relations. The function recursively searches the graph for all entry points that can be reached from the target relation through the specified source relation. The resulting entry points contain a reference to the relation object in the schema graph and the relation used to expand user sets for the entry point. If the target or source relation does not exist in the schema graph, the function returns an error.

Parameters:

  • target: pointer to a base.RelationReference that identifies the target relation
  • source: pointer to a base.RelationReference that identifies the source relation used to reach the target relation

Returns:

  • slice of LinkedEntrance objects that represent entry points into the LinkedSchemaGraph, or an error if the target or source relation does not exist in the schema graph

Jump to

Keyboard shortcuts

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