Table of Contents
In addition to the expressions listed in the Ash expressions guide , AshPostgres provides the following expressions
fragment allows you to embed raw sql into the query. Use question marks to interpolate values from the outer expression.
Ash.Query.filter(User, fragment("? IS NOT NULL", first_name))
These wrap the postgres builtin like and ilike operators.
Please be aware, these match
not raw text. Use
contains/1 if you want to match text without supporting patterns, i.e
_ have semantic meaning!
Ash.Query.filter(User, like(name, "%obo%")) # name contains obo anywhere in the string, case sensitively
Ash.Query.filter(User, ilike(name, "%ObO%")) # name contains ObO anywhere in the string, case insensitively
To use this expression, you must have the
pg_trgm extension in your repos
This calls the
similarity function from that extension. See more
Ash.Query.filter(User, trigram_similarity(first_name, "fred") > 0.8)