Documentation
¶
Overview ¶
Package gate compiles and evaluates a route's whenExpr — the single CEL boolean that decides whether chaski acts on a request. CEL is a safe, bounded, non-Turing-complete language (no I/O, no unbounded loops), so an operator-supplied predicate over an untrusted payload can't hang or escape. Each expression is compiled and type-checked once at load (fail-fast) and evaluated under a cost limit and the request's context deadline.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gate ¶
type Gate struct {
// contains filtered or unexported fields
}
Gate is a compiled whenExpr. The zero gate (from an empty expression) always fires, so a route without a whenExpr acts on every request (default true).
func Compile ¶
Compile parses and type-checks expr. An empty expression yields an always-true gate. A syntactically invalid expression, an unknown variable/function, or one that cannot produce a boolean is an error.
type Input ¶
type Input struct {
Payload any // decoded body; dyn (map, list, or scalar)
Headers map[string]string // lower-cased header names
Query map[string]string // first value per query key
Method string
Route string
Now time.Time
}
Input is the variable environment a whenExpr is evaluated against.