ExAliyunOts.get_range
You're seeing just the function
get_range
, go back to ExAliyunOts module for more information.
Link to this function
get_range(instance, table_name, inclusive_start_primary_keys, exclusive_end_primary_keys, options \\ [])
View SourceOfficial document in Chinese | English
Example
import MyApp.TableStore
get_range "table_name",
[{"key1", 1}, {"key2", :inf_min}],
[{"key1", 4}, {"key2", :inf_max}],
direction: :forward
get_range "table_name",
[{"key1", 1}, {"key2", :inf_min}],
[{"key1", 4}, {"key2", :inf_max}],
time_range: {1525922253224, 1525923253224},
direction: :forward
get_range "table_name",
[{"key1", 1}, {"key2", :inf_min}],
[{"key1", 4}, {"key2", :inf_max}],
time_range: 1525942123224,
direction: :forward
Also, there is an alternative stream_range/5
to iteratively get range of rows in stream.
Options
:direction
, required, the order of fetch data, available options are:forward
|:backward
, by it is:forward
.:forward
, this query is performed in the order of primary key in ascending, in this case, inputinclusive_start_primary_keys
should less thanexclusive_end_primary_keys
;:backward
, this query is performed in the order of primary key in descending, in this case, inputinclusive_start_primary_keys
should greater thanexclusive_end_primary_keys
.
:columns_to_get
, optional, fetch the special fields, by default it returns all fields, pass a field list to specify the expected return fields, e.g.["field1", "field2"]
.:start_column
, optional, specifies the start column when using for wide-row-read, the returned result contains this:start_column
.:end_column
, optional, specifies the end column when using for wide-row-read, the returned result does not contain this:end_column
.:filter
, optional, filter the return results in the server side, please seefilter/1
for details.:max_versions
, optional, how many versions need to return in results, by default it is 1.:transaction_id
, optional, read operation within local transaction.: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.:time_range
, optional, read data by timestamp range, support two ways to use it:time_range: {start_timestamp, end_timestamp}
, the timestamp in the range (includestart_timestamp
but excludeend_timestamp
) and then will return in the results.time_range: special_timestamp
, exactly match and then will return in the results.:time_range
and:max_versions
are mutually exclusive, by default usemax_versions: 1
andtime_range: nil
.