View Source Appwrite.Query (appwrite v0.1.2)

A helper module to generate query strings for Appwrite filters.

This module provides functions to construct queries for filtering, sorting, and limiting resources in an Appwrite database.

Each function returns a JSON string representation of the query.

Summary

Functions

Filter resources where attribute is between the start and end values (inclusive).

Filter resources where attribute contains the specified value(s).

Return results after the specified document ID.

Return results before the specified document ID.

Filter resources where attribute ends with the value.

Filter resources where attribute is equal to the value.

Filter resources where attribute is greater than the value.

Filter resources where attribute is greater than or equal to the value.

Filter resources where attribute is not null.

Filter resources where attribute is null.

Filter resources where attribute is less than the value.

Filter resources where attribute is less than or equal to the value.

Limit the number of results returned.

Combine multiple queries using logical AND.

Combine multiple queries using logical OR.

Create a query with the given method, attribute, and values.

Filter resources where attribute is not equal to the value.

Skip the first offset number of results.

Sort results by attribute ascending.

Sort results by attribute descending.

Filter resources by searching an attribute for a value.

Specify which attributes should be returned by the API call.

Filter resources where attribute starts with the value.

Types

@type attributes_types() :: String.t() | [String.t()]
@type query_types() :: query_types_single() | query_types_list()
@type query_types_list() :: [String.t() | number() | boolean() | map()]
@type query_types_single() :: String.t() | number() | boolean()

Functions

Link to this function

between(attribute, start_value, end_value)

View Source

Filter resources where attribute is between the start and end values (inclusive).

Link to this function

contains(attribute, value)

View Source
@spec contains(String.t(), String.t() | [String.t()]) :: String.t()

Filter resources where attribute contains the specified value(s).

Link to this function

cursor_after(document_id)

View Source
@spec cursor_after(String.t()) :: String.t()

Return results after the specified document ID.

Link to this function

cursor_before(document_id)

View Source
@spec cursor_before(String.t()) :: String.t()

Return results before the specified document ID.

Link to this function

ends_with(attribute, value)

View Source
@spec ends_with(String.t(), String.t()) :: String.t()

Filter resources where attribute ends with the value.

@spec equal(String.t(), query_types()) :: String.t()

Filter resources where attribute is equal to the value.

Link to this function

greater_than(attribute, value)

View Source
@spec greater_than(String.t(), query_types()) :: String.t()

Filter resources where attribute is greater than the value.

Link to this function

greater_than_equal(attribute, value)

View Source
@spec greater_than_equal(String.t(), query_types()) :: String.t()

Filter resources where attribute is greater than or equal to the value.

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

Filter resources where attribute is not null.

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

Filter resources where attribute is null.

Link to this function

less_than(attribute, value)

View Source
@spec less_than(String.t(), query_types()) :: String.t()

Filter resources where attribute is less than the value.

Link to this function

less_than_equal(attribute, value)

View Source
@spec less_than_equal(String.t(), query_types()) :: String.t()

Filter resources where attribute is less than or equal to the value.

@spec limit(non_neg_integer()) :: String.t()

Limit the number of results returned.

@spec logical_and([String.t()]) :: String.t()

Combine multiple queries using logical AND.

@spec logical_or([String.t()]) :: String.t()

Combine multiple queries using logical OR.

Link to this function

new(method, attribute \\ nil, values \\ nil)

View Source
@spec new(String.t(), attributes_types() | nil, query_types() | nil) :: String.t()

Create a query with the given method, attribute, and values.

Examples

iex> Appwrite.Query.new("equal", "name", "John")
"{"method":"equal","attribute":"name","values":["John"]}"
Link to this function

not_equal(attribute, value)

View Source
@spec not_equal(String.t(), query_types()) :: String.t()

Filter resources where attribute is not equal to the value.

@spec offset(non_neg_integer()) :: String.t()

Skip the first offset number of results.

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

Sort results by attribute ascending.

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

Sort results by attribute descending.

Link to this function

search(attribute, value)

View Source
@spec search(String.t(), String.t()) :: String.t()

Filter resources by searching an attribute for a value.

@spec select([String.t()]) :: String.t()

Specify which attributes should be returned by the API call.

Link to this function

starts_with(attribute, value)

View Source
@spec starts_with(String.t(), String.t()) :: String.t()

Filter resources where attribute starts with the value.