exprreader

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package exprreader compiles YAML and JSON rule documents into rules.RuleSet values.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidRuleDocument reports malformed YAML/JSON or schema validation.
	ErrInvalidRuleDocument = errors.New("exprreader rule document is invalid")
	// ErrInvalidRuleExpression reports expression parse, compile, or type-check failure.
	ErrInvalidRuleExpression = errors.New("exprreader rule expression is invalid")
	// ErrInvalidRuleAction reports unsupported or invalid declarative actions.
	ErrInvalidRuleAction = errors.New("exprreader rule action is invalid")
)

Functions

This section is empty.

Types

type Document

type Document struct {
	// Rules contains compiled rules in deterministic RuleSet order.
	Rules *rules.RuleSet
	// EngineConfig contains the optional sequential engine configuration.
	EngineConfig rules.EngineConfig
}

Document is the compiled representation of a rule reader document.

func Load

func Load(ctx context.Context, r io.Reader, options ...Option) (*Document, error)

Load reads a YAML or JSON rule document and compiles it into rules.

type Option

type Option func(*config)

Option configures document loading.

func WithMaxNodes

func WithMaxNodes(maxNodes uint) Option

WithMaxNodes sets the maximum expression AST node count accepted at compile time.

type ReaderError

type ReaderError struct {
	RuleName string
	Field    string
	Err      error
}

ReaderError wraps reader failures with optional rule and field context.

func (ReaderError) Error

func (e ReaderError) Error() string

Error returns a human-readable reader error.

func (ReaderError) Unwrap

func (e ReaderError) Unwrap() error

Unwrap returns the underlying reader failure.

Jump to

Keyboard shortcuts

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