Documentation
¶
Index ¶
- func BodiesToUCAST(bs []ast.Body, opts *Opts) *ucast.UCASTNode
- func ExtractMaskRuleRefFromAnnotations(comp *ast.Compiler, ref ast.Ref) (ast.Ref, *ast.Error)
- func ExtractUnknownsFromAnnotations(comp *ast.Compiler, ref ast.Ref) ([]ast.Ref, []*ast.Error)
- func FromASTErrors(errs ...*ast.Error) error
- type Constraint
- type ConstraintSet
- type Constraints
- type Details
- type Opts
- type Results
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromASTErrors ¶
Types ¶
type Constraint ¶
Constraint lets us limit the Set that are allowed in a translation. There are hardcoded sets of supported Set. The constraints become effective during the post-PE analysis (compile.Checks()).
func NewConstraints ¶
func NewConstraints(typ, variant string) (*Constraint, error)
NewConstraints returns a new Constraint object based on the type requested, ucast or sql.
func (*Constraint) AssertBuiltin ¶
func (c *Constraint) AssertBuiltin(x string) error
func (*Constraint) AssertFeature ¶
func (c *Constraint) AssertFeature(x string) error
func (*Constraint) Builtin ¶
func (c *Constraint) Builtin(x string) bool
Builtin returns true if the builtin is supported by the constraint.
func (*Constraint) String ¶
func (c *Constraint) String() string
func (*Constraint) Supports ¶
func (c *Constraint) Supports(x string) bool
Supports allows us to encode more fluent constraints, like support for "not". It returns an error if the feature is not supported by the constraint.
type ConstraintSet ¶
type ConstraintSet struct {
Constraints []*Constraint
}
func NewConstraintSet ¶
func NewConstraintSet(cs ...*Constraint) *ConstraintSet
func (*ConstraintSet) AssertBuiltin ¶
func (cs *ConstraintSet) AssertBuiltin(x string) error
func (*ConstraintSet) AssertFeature ¶
func (cs *ConstraintSet) AssertFeature(x string) error
AssertFeature returns an error if the feature is not supported by any of the constraints. The error contains the offending target/dialect pairs.
func (*ConstraintSet) Builtin ¶
func (cs *ConstraintSet) Builtin(x string) bool
Builtin returns true if all the constraints in the set support the builtin.
func (*ConstraintSet) String ¶
func (cs *ConstraintSet) String() string
func (*ConstraintSet) Supports ¶
func (cs *ConstraintSet) Supports(x string) bool
Supports returns true if the feature is supported by all constraints.
type Constraints ¶
type Results ¶
type Results struct {
// contains filtered or unexported fields
}
func Check ¶
func Check(pq *rego.PartialQueries, constraints Constraints, shorts Set[string]) *Results
Check performs a set of checks on the given partial queries and support modules. The constraints are used to determine which features are allowed in the partial queries. The shorts are used to determine which short names are allowed, e.g. `input.foo` is allowed if it's mapped to some table column.
type Set ¶
type Set[T comparable] map[T]struct{}
func NewSet ¶
func NewSet[T comparable](strs ...T) Set[T]
func (Set[T]) Intersection ¶
Intersection returns a new set containing elements present in both sets