View Source ArangoXEcto.Query (ArangoX Ecto v1.3.1)
Converts Ecto.Query
structs into AQL syntax.
This module is copied from
https://github.com/ArangoDB-Community/arangodb_ecto/blob/master/lib/arangodb_ecto/query.ex.
All credit goes to mpoeter
, the original author. Please go check out the original of this file.
This is an updated version for Ecto V3
Link to this section Summary
Functions
Creates an AQL query to fetch all entries from the data store matching the given Ecto query.
Creates an AQL query to delete all entries from the data store matching the given Ecto query.
A OR search query expression.
An AND search query expression.
Creates an AQL query to update all entries from the data store matching the given Ecto query.
Link to this section Functions
@spec all(Ecto.Query.t()) :: binary()
Creates an AQL query to fetch all entries from the data store matching the given Ecto query.
@spec delete_all(Ecto.Query.t()) :: binary()
Creates an AQL query to delete all entries from the data store matching the given Ecto query.
A OR search query expression.
Extention to the Ecto.Query
api for arango searches.
This function is the same as ArangoXEcto.Query.search/3
except implements as an or clause.
This also follows the same syntax as the Ecto.Query.or_where/3
function.
An AND search query expression.
Extention to the Ecto.Query
api for arango searches.
The expression syntax is exactly the same as the regular Ecto.Query.where/3
clause.
Refer to that for more info on syntax or for advanced AQL queries see the section below.
You will need to import this function like you do for Ecto.Query
.
implementation
Implementation
This will store the search in the Ecto query where
clause
with a custom search operation. This is to prevent having to create a seperate query
type. When converting the Ecto query to an AQL query, this is caught and changed
into an AQL SEARCH
expression.
using-analyzers-and-advanced-aql
Using Analyzers and advanced AQL
To save having to learn some new kind of query format for so many different possible search
scenarios, you can just use AQL directly in. This is powered by the Ecto.Query.API.fragment/1
function.
Below is an example of how you can implement using a custom analyzer:
from(UsersView)
|> search([uv], fragment("ANALYZER(? == ?, "identity")", uv.first_name, "John"))
|> Repo.all()
@spec update_all(Ecto.Query.t()) :: binary()
Creates an AQL query to update all entries from the data store matching the given Ecto query.