AshOps.QueryLang (ash_ops v0.2.3)

The query language for simple queries entered on the command-line.

This query language is not capable of expressing the full breadth of the Ash expression language. It is designed to provide a simple subset of filters available to users of AshOps. If you need something more advanced then it's probably a good idea to make a special read query filtered in the way you require and expose that as a mix task instead.

Syntax

The Ash Ops query language is very similar to the Ash expression syntax while not actually being Elixir.

Literals

  • true and false boolean literals.
  • Integer literals, eg 123, -123 and 0.
  • Float literals, of the form 1.23 and -1.23 (ie not scientific notation).
  • String literals of delimited with both single ticks (') and double ticks (") are interpreted as Elixir binaries.
  • Attribute path literals are entered directly, separated by . as necessary.

Infix operators

The following infix operators (and their aliases) are available:

  • && and and,
  • || and or,
  • * and times,
  • / and div,
  • + and plus,
  • - and minus,
  • <> and concat,
  • in,
  • > and gt,
  • >= and gte,
  • < and lt,
  • <= and lte,
  • == and eq,
  • != and not_eq.

Function calls

Function calls of the form function(arg, arg) format are allowed. The functions available are highly dependant on the extensions and data layer being used by the resource being queried.

Summary

Functions

Parse a query and return a compiled Ash.Query struct.

Functions

parse(task, query)

@spec parse(AshOps.entity(), nil | String.t()) ::
  {:ok, Ash.Query.t()} | {:error, any()}

Parse a query and return a compiled Ash.Query struct.