def validation

bendvy-ecs-core@0.1.0.3 · relation_graph.bend:107

import bendvy-ecs-core@0.1.0.3/relation_graph.bend as RelationGraph
import Base
import entity_key.bend as K
import relation_types.bend as T

107def validation(sourceLive: Bool,targetLive: Bool,self: Bool,cyclic: Bool,source: K.Key,target: K.Key,name: String) -> Maybe<&2,T.Error>:
108  match sourceLive targetLive self cyclic:
109    case False{} _ _ _: Some{T.MissingEntity{source}}
110    case True{} False{} _ _: Some{T.MissingTargetEntity{source,target,name}}
111    case True{} True{} True{} _: Some{T.SelfRelationNotAllowed{source,name}}
112    case True{} True{} False{} True{}: Some{T.HierarchyCycle{source,target,name}}
113    case True{} True{} False{} False{}: None{}

Uses (5)

Used by (1)