generator

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTraceValueNode

func BuildTraceValueNode(mapContent string) string

func GenerateTopLevelExpression

func GenerateTopLevelExpression(exp profile.Rule, iriExpander *misc.IriExpander) string

func IriExpanderFrom

func IriExpanderFrom(profile profile.Profile) *misc.IriExpander

Types

type BranchRegoResult

type BranchRegoResult struct {
	Constraint string
	Branch     []SimpleRegoResult
}

func GenerateAnd

func GenerateAnd(and profile.AndRule, iriExpander *misc.IriExpander) []BranchRegoResult

Generates code snippets for an AND rule. The result is a set of branches, since we just need one of the predicates to produce an error for the validation to fail, we branch for each clause

func GenerateConditional

func GenerateConditional(conditional profile.ConditionalRule, iriExpander *misc.IriExpander) []BranchRegoResult

func GenerateOr

func GenerateOr(or profile.OrRule, iriExpander *misc.IriExpander) []BranchRegoResult

func (BranchRegoResult) ConstraintId

func (r BranchRegoResult) ConstraintId() string

type GeneratedRegoResult

type GeneratedRegoResult interface {
	ConstraintId() string
}

func Dispatch

func Dispatch(r profile.Rule, iriExpander *misc.IriExpander) []GeneratedRegoResult

func GenerateNestedExpression

func GenerateNestedExpression(exp profile.Rule, iriExpander *misc.IriExpander) []GeneratedRegoResult

type RegoPathResult

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

func GenerateNodeArray

func GenerateNodeArray(path path.PropertyPath, variable string, iriExpander *misc.IriExpander) RegoPathResult

GenerateNodeArray Traverses the path but just returns a generator of nodes instead of an array of values (allows duplicate values)

func GenerateNodeSet

func GenerateNodeSet(path path.PropertyPath, variable string, iriExpander *misc.IriExpander) RegoPathResult

GenerateNodeSet Traverses the path but just returns a generator of nodes instead of a set of values

func GeneratePropertyArray

func GeneratePropertyArray(path path.PropertyPath, variable string, iriExpander *misc.IriExpander) RegoPathResult

GeneratePropertyArray Traversed the path, starting at the provided variable and returns an array of reached values (allows duplicate values)

func GeneratePropertySet

func GeneratePropertySet(path path.PropertyPath, variable string, iriExpander *misc.IriExpander) RegoPathResult

GeneratePropertySet Traversed the path, starting at the provided variable and returns a set of reached values

type RegoUnit

type RegoUnit struct {
	Name       string
	Entrypoint string
	Code       string
	Prefixes   profile.ProfileContext
}

func Generate

func Generate(profile profile.Profile) RegoUnit

Generate Main entry point generating a valid Rego unit from a parsed profile. It uses the encoded Rego preamble code to provide all the library code to execute the profile.

type SimpleRegoResult

type SimpleRegoResult struct {
	Constraint string           // constraint being evaluated
	Rego       []string         // rego code with the constraint
	Path       string           // path from the parent node to this node
	Variable   string           // variable with the result for the next evaluation
	TraceValue string           // evidence value for tracing
	TraceNode  string           // trace code
	PathRules  []RegoPathResult //path rules to generate the path rule
}

func GenerateClassTarget

func GenerateClassTarget(variable string, class string, iriExpander *misc.IriExpander) SimpleRegoResult

func GenerateCount

func GenerateCount(count profile.CountRule, iriExpander *misc.IriExpander) []SimpleRegoResult

GenerateCount Generates the Rego code snippet for the rule, supports minCount/maxCount and minLength/maxLength

func GenerateDatatype

func GenerateDatatype(datatype profile.DatatypeRule, iriExpander *misc.IriExpander) []SimpleRegoResult

func GenerateNested

func GenerateNested(nested profile.NestedExpression, iriExpander *misc.IriExpander) SimpleRegoResult

func GenerateNumericComparison

func GenerateNumericComparison(num profile.NumericRule, iriExpander *misc.IriExpander) []SimpleRegoResult

func GeneratePattern

func GeneratePattern(pattern profile.PatternRule, iriExpander *misc.IriExpander) []SimpleRegoResult

func GeneratePropertyComparison

func GeneratePropertyComparison(comparison profile.PropertyComparisonRule, iriExpander *misc.IriExpander) []SimpleRegoResult

func GenerateRegoRule

func GenerateRegoRule(rule profile.RegoRule, iriExpander *misc.IriExpander) []SimpleRegoResult

func GenerateScalarIntersectSetRule

func GenerateScalarIntersectSetRule(containsSome profile.ScalarSetRule, iriExpander *misc.IriExpander) []SimpleRegoResult

func GenerateScalarSubSetRule

func GenerateScalarSubSetRule(containsAll profile.ScalarSetRule, iriExpander *misc.IriExpander) []SimpleRegoResult

func GenerateScalarSuperSetRule

func GenerateScalarSuperSetRule(in profile.ScalarSetRule, iriExpander *misc.IriExpander) []SimpleRegoResult

func GenerateUniqueValues

func GenerateUniqueValues(uniqueValues profile.UniqueValuesRule, iriExpander *misc.IriExpander) []SimpleRegoResult

func (SimpleRegoResult) ConstraintId

func (r SimpleRegoResult) ConstraintId() string

Jump to

Keyboard shortcuts

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