View Source Ecto.Adapters.DynamoDB.Query (ecto_adapters_dynamodb v3.4.0)
Some query wrapper functions for helping us query dynamo db. Selects indexes to use, etc.
Not to be confused with Ecto.Query
.
Summary
Functions
Given a map with a search criteria, finds the best index to search against it. Returns a tuple indicating whether it's a primary key index, or a secondary index. To query against a secondary index in Dynamo, we NEED to have it's index name, so secondary indexes are returned as a tuple with the field name, whilst the primary key uses the atom :primary to distinguish it.
Same as get_best_index, but refers to a scan option on failure
Given a search criteria of 1 or more fields, we try find out if the primary key is a good match and can be used to forfill this search. Returns the tuple {:primary, [hash] | [hash, range]} or :not_found
Given a keyword list containing search field, value and operator to search for (which may also be nested under logical operators, e.g., [{"id", {"franko", :==}}]
, or [{:and, [{"circle_id", {"123", :==}}, {"person_id", {"abc", :>}}]}
), will return the dynamo db index description that will help us match this search. return :not_found if no index is found.
Formats the recursive option according to whether the query is a DynamoDB scan or query. (The adapter defaults to recursive fetch in case of the latter but not the former)
Returns an atom, :scan or :query, specifying whether the current search will be a DynamoDB scan or a query.
Updates the recursive option during a recursive fetch, according to whether the option is a boolean or an integer (as in the case of page_limit)
Types
Functions
@spec get_best_index(Ecto.Repo.t(), table_name(), search(), query_opts()) :: :not_found | {:primary, [String.t()]} | {:primary_partial, [String.t()]} | {String.t(), [String.t()]} | {:secondary_partial, String.t(), [String.t()]} | no_return()
Given a map with a search criteria, finds the best index to search against it. Returns a tuple indicating whether it's a primary key index, or a secondary index. To query against a secondary index in Dynamo, we NEED to have it's index name, so secondary indexes are returned as a tuple with the field name, whilst the primary key uses the atom :primary to distinguish it.
| {"index_name", [indexed_fields_list]}
Exception if the index doesn't exist.
Same as get_best_index, but refers to a scan option on failure
@spec get_item(Ecto.Repo.t(), table_name(), search(), keyword()) :: dynamo_response() | no_return()
Given a search criteria of 1 or more fields, we try find out if the primary key is a good match and can be used to forfill this search. Returns the tuple {:primary, [hash] | [hash, range]} or :not_found
Given a keyword list containing search field, value and operator to search for (which may also be nested under logical operators, e.g., [{"id", {"franko", :==}}]
, or [{:and, [{"circle_id", {"123", :==}}, {"person_id", {"abc", :>}}]}
), will return the dynamo db index description that will help us match this search. return :not_found if no index is found.
Returns a tuple of {"index_name", [ hash_key or hash,range_key]]} or :not_found TODO: Does not help with range queries. -> The match_index_hash_part function is beginning to address this.
Formats the recursive option according to whether the query is a DynamoDB scan or query. (The adapter defaults to recursive fetch in case of the latter but not the former)
Returns an atom, :scan or :query, specifying whether the current search will be a DynamoDB scan or a query.
Updates the recursive option during a recursive fetch, according to whether the option is a boolean or an integer (as in the case of page_limit)