models

package
v0.0.0-...-f328a8e Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Policy

type Policy struct {
	ID              string
	Name            string
	Expression      string
	Rules           []Rule
	Thresholds      []Threshold
	CompiledProgram cel.Program
}

func (*Policy) AddRule

func (p *Policy) AddRule(env *cel.Env, rule Rule) error

func (*Policy) Evaluate

func (p *Policy) Evaluate(input map[string]interface{}) (string, []RuleResult, error)

func (*Policy) ShouldExecute

func (p *Policy) ShouldExecute(input map[string]interface{}) (bool, error)

type Rule

type Rule struct {
	Name            string
	Expression      string
	CompiledProgram cel.Program
}

func (*Rule) BuildProgram

func (r *Rule) BuildProgram(env *cel.Env) error

func (*Rule) Evaluate

func (r *Rule) Evaluate(input map[string]interface{}) (RuleResult, error)

type RuleResult

type RuleResult struct {
	Score    int64
	Stop     bool
	Passed   bool
	Executed bool
}

type Threshold

type Threshold struct {
	ID    string
	Value int64 // Cambiato da int a int64
}

Jump to

Keyboard shortcuts

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