MCPcopy Create free account
hub / github.com/cel-expr/cel-go / NewRuleComposer

Function NewRuleComposer

policy/composer.go:47–61  ·  view source on GitHub ↗

NewRuleComposer creates a rule composer which stitches together rules within a policy into a single CEL expression.

(env *cel.Env, opts ...ComposerOption)

Source from the content-addressed store, hash-verified

45// NewRuleComposer creates a rule composer which stitches together rules within a policy into
46// a single CEL expression.
47func NewRuleComposer(env *cel.Env, opts ...ComposerOption) (*RuleComposer, error) {
48 composer := &RuleComposer{
49 env: env,
50 // set the default nesting height to something reasonable.
51 exprUnnestHeight: 25,
52 }
53 var err error
54 for _, opt := range opts {
55 composer, err = opt(composer)
56 if err != nil {
57 return nil, err
58 }
59 }
60 return composer, nil
61}
62
63// RuleComposer optimizes a set of expressions into a single expression.
64type RuleComposer struct {

Callers 5

TestCompose_SourceInfoFunction · 0.85
TestCompose_UnnestFunction · 0.85
TestRuleComposerErrorFunction · 0.85
TestRuleComposerUnnestFunction · 0.85
CompileFunction · 0.85

Calls

no outgoing calls

Tested by 4

TestCompose_SourceInfoFunction · 0.68
TestCompose_UnnestFunction · 0.68
TestRuleComposerErrorFunction · 0.68
TestRuleComposerUnnestFunction · 0.68