DripDrop.Conditions.Predicate (DripDrop v0.1.0)

Copy Markdown View Source

Predicate parsing and evaluation for condition rules.

Summary

Functions

Builds a Predicated query from structured condition parts.

Evaluates a predicate against runtime context.

Validates a stored predicate expression without evaluating it.

Types

predicate()

@type predicate() :: binary() | [map()] | [struct()]

Functions

from_parts(field_path, operator, expected)

@spec from_parts(binary() | nil, binary() | nil, term()) ::
  {:ok, binary()} | {:error, term()}

Builds a Predicated query from structured condition parts.

test(predicate, context)

@spec test(predicate() | nil, map()) :: {:ok, boolean()} | {:error, term()}

Evaluates a predicate against runtime context.

validate(predicate)

@spec validate(predicate() | nil) :: :ok | {:error, term()}

Validates a stored predicate expression without evaluating it.