rules

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package rules compiles and evaluates the boolean expressions used by choice nodes. Expressions are written in expr-lang and evaluated against the shared execution payload, exposed as the variable `payload`.

when: "payload.risk_score > 80"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Program

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

Program is a compiled choice expression.

func Compile

func Compile(code string) (*Program, error)

Compile compiles a boolean expression that may reference `payload`.

func (*Program) Match

func (p *Program) Match(payload json.RawMessage) (bool, error)

Match evaluates the program against the JSON payload. A nil/zero result and a non-nil error are returned when evaluation fails (e.g. a referenced field is missing); callers typically treat that as "no match" and fall through to the default rule.

Jump to

Keyboard shortcuts

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