View Source Dx.Engine (dx v0.3.0)

Encapsulates the main functionality of working with rules.

Link to this section Summary

Functions

Traverses the value of a rule, replacing special tuples

Returns the result of evaluating a field or predicate.

Returns the result of evaluating a predicate.

Link to this section Functions

Link to this function

evaluate_condition(condition, subjects, eval)

View Source
@spec evaluate_condition(any(), any(), Dx.Evaluation.t()) :: Dx.Result.b()
Link to this function

map_result(struct, eval)

View Source

Traverses the value of a rule, replacing special tuples

  • {:ref, path} with the predicate or field value found at the given path
  • {fun/n, arg_1, ..., arg_n} with the result of calling the given function with the given arguments (which in turn can be special tuples)
  • {:bound, :var} - with a corresponding matching {:bind, :var}
  • {:bound, :var, default} - same with default
  • ...
Link to this function

resolve(field, subject, eval)

View Source
@spec resolve(atom(), map(), Dx.Evaluation.t()) :: Dx.Result.v()

Returns the result of evaluating a field or predicate.

Link to this function

resolve_predicate(predicate, subject, eval)

View Source
@spec resolve_predicate(atom(), struct(), Dx.Evaluation.t()) :: Dx.Result.v()

Returns the result of evaluating a predicate.

Link to this function

resolve_source(field_or_predicate, eval)

View Source