AshArcadic.Query.Expression (AshArcadic v0.1.0)

Copy Markdown View Source

Translates an Ash value-expression (an expression calculation's body, or a compound operand of a filter/sort) into a parameterized Cypher SCALAR. Used by AshArcadic.Query.Filter (WHERE operands) and the sort path (ORDER BY) — NOT the load path (loaded calculations compute in Elixir, AshArcadic.DataLayer.run_query).

Every literal rides a bound $param (Query.add_param/2); every field name is Identifier.validate!-d; operators/functions are fixed keywords (Rule 1). A Ref to a non-stored / sensitive / :binary / :decimal field, or an un-mapped operator/function, fails closed value-free (%UnsupportedFilter{} — operator/function + field only, Rule 4). Division forces float semantics (toFloat) to match Ash's integer→float /.

Summary

Functions

translate(value, query)

@spec translate(term(), AshArcadic.Query.t()) ::
  {:ok, AshArcadic.Query.t(), String.t()} | {:error, term()}