EctoTablestore.Repo.get_range

You're seeing just the callback get_range, go back to EctoTablestore.Repo module for more information.
Link to this callback

get_range(schema, options)

View Source

Specs

get_range(schema(), options()) ::
  {nil, nil} | {list(), nil} | {list(), binary()} | {:error, term()}

Get multiple structs by range to the schema, result in :forward direction by default.

Example

Simply get result in a range request:

Repo.get_range(Order)
Repo.get_range(Order, direction: :backward)

If the Order schema has multiple primary keys, and the :id field is the partition key, we can get records in range under the partition key "1" in this way:

Repo.get_range(%Order{id: "1"})

Options

See get_range/4.

Link to this callback

get_range(schema, start_primary_keys, end_primary_keys, options)

View Source

Specs

get_range(
  schema(),
  start_primary_keys :: list() | binary(),
  end_primary_keys :: list(),
  options()
) :: {nil, nil} | {list(), nil} | {list(), binary()} | {:error, term()}

Get multiple structs by range from one table, rely on the conjunction of the partition key and other primary key(s).

Options

  • :direction, by default it is :forward, set it as :forward to make the order of the query result in ascending by primary key(s), set it as :backward to make the order of the query result in descending by primary key(s).

  • :columns_to_get, string list, return the specified attribute columns, if not specify this field all attribute columns will be return.

  • :start_column, string, used as a starting column for Wide Column read, the return result contains this as starter.

  • :end_column, string, used as a ending column for Wide Column read, the return result DON NOT contain this column.

  • :limit, optional, the maximum number of rows of data to be returned, this value must be greater than 0, whether this option is set or not, there returns a maximum of 5,000 data rows and the total data size never exceeds 4 MB.

  • :transaction_id, read under local transaction in a partition key.

  • :filter, used as a filter by condition, support ">", "<", ">=", "<=", "==", "and", "or" and "()" expressions.

    The ignore_if_missing option can be used for the non-existed attribute column, for example: An attribute column does not exist meanwhile set it as true, will ignore this match condition in the return result; An existed attribute column DOES NOT suit for this use case, the match condition will always affect the return result, if match condition does not satisfy, they won't be return in result.

      filter: filter(({"name", ignore_if_missing: true} == var_name and "age" > 1) or ("class" == "1"))