View Source Ravix.RQL.Query (ravix v0.0.2)

Detructurized Raven Query Language structure

Link to this section Summary

Functions

Delete all the documents that matches the informed query

Adds a Ravix.RQL.Tokens.From to the query with an alias

Executes a list query in the informed session

Create a Query using a raw RQL string

Create a Query using a raw RQL string with parameters

Updates all the documents that matches the informed query

Link to this section Types

@type t() :: %Ravix.RQL.Query{
  aliases: map(),
  and_tokens: [Ravix.RQL.Tokens.And.t()],
  from_token: Ravix.RQL.Tokens.From.t() | nil,
  is_raw: boolean(),
  limit_token: Ravix.RQL.Tokens.Limit.t() | nil,
  or_tokens: [Ravix.RQL.Tokens.Or.t()],
  params_count: non_neg_integer(),
  projection_token: any(),
  query_params: map(),
  query_string: String.t(),
  update_token: Ravix.RQL.Tokens.Update.t() | nil,
  where_token: Ravix.RQL.Tokens.Where.t() | nil
}

Link to this section Functions

@spec and?(t(), Ravix.RQL.Tokens.Condition.t()) :: t()

Adds a Ravix.RQL.Tokens.And to the query

Link to this function

delete_for(query, session_id)

View Source
@spec delete_for(t(), binary()) :: {:error, any()} | {:ok, any()}

Delete all the documents that matches the informed query

@spec from(nil | bitstring()) :: {:error, :query_document_must_be_informed} | t()

Adds a Ravix.RQL.Tokens.From to the query

Link to this function

from(document, as_alias)

View Source

Adds a Ravix.RQL.Tokens.From to the query with an alias

Link to this function

limit(query, skip, next)

View Source
@spec limit(t(), non_neg_integer(), non_neg_integer()) :: t()
Link to this function

list_all(query, session_id)

View Source
@spec list_all(t(), binary()) :: {:error, any()} | {:ok, any()}

Executes a list query in the informed session

@spec or?(t(), Ravix.RQL.Tokens.Condition.t()) :: t()

Adds a Ravix.RQL.Tokens.Or to the query

@spec raw(String.t()) :: t()

Create a Query using a raw RQL string

@spec raw(String.t(), map()) :: t()

Create a Query using a raw RQL string with parameters

Link to this function

update(query, document_updates)

View Source
@spec update(t(), map()) :: t()

Adds a Ravix.RQL.Tokens.Update to the query

Link to this function

update_for(query, session_id)

View Source
@spec update_for(t(), binary()) :: {:error, any()} | {:ok, any()}

Updates all the documents that matches the informed query

@spec where(t(), Ravix.RQL.Tokens.Condition.t()) :: t()

Adds a Ravix.RQL.Tokens.Where to the query