Appwrite.Query (appwrite v0.1.1)

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

Link to this type

attributes_types()

@type attributes_types() :: String.t() | [String.t()]
Link to this type

query_types()

@type query_types() :: query_types_single() | query_types_list()
Link to this type

query_types_list()

@type query_types_list() :: [String.t() | number() | boolean() | map()]
Link to this type

query_types_single()

@type query_types_single() :: String.t() | number() | boolean()

Functions

Link to this function

between(attribute, start_value, end_value)

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

Link to this function

contains(attribute, value)

@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)

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

Return results after the specified document ID.

Link to this function

cursor_before(document_id)

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

Return results before the specified document ID.

Link to this function

ends_with(attribute, value)

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

Filter resources where attribute ends with the value.

Link to this function

equal(attribute, 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)

@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)

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

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

Link to this function

is_not_null(attribute)

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

Filter resources where attribute is not null.

Link to this function

is_null(attribute)

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

Filter resources where attribute is null.

Link to this function

less_than(attribute, value)

@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)

@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.

Link to this function

logical_and(queries)

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

Combine multiple queries using logical AND.

Link to this function

logical_or(queries)

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

Combine multiple queries using logical OR.

Link to this function

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

@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)

@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.

Link to this function

order_asc(attribute)

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

Sort results by attribute ascending.

Link to this function

order_desc(attribute)

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

Sort results by attribute descending.

Link to this function

search(attribute, value)

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

Filter resources by searching an attribute for a value.

Link to this function

select(attributes)

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

Specify which attributes should be returned by the API call.

Link to this function

starts_with(attribute, value)

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

Filter resources where attribute starts with the value.