Otto v0.1.2 Otto.Table behaviour View Source
Define an ots table.
Usage
defmodule DemoTableCreate do
use Otto.Table,
instance: Instance1,
table: "test_table",
primary: [:pk1, :pk2],
encrypt: [:enc1, :enc2],
reserved_throughput_read: 10,
index: [
index_name1: [field_name1: :long, field_name2: :text],
index_name2: [field_name1: :keyword, field_name2: :text]
]
end
Options
required fields
table
- The ots table name, it should be unique in one instance.primary
- Primary keys list, by order, up to 4. The first key is the partition key.
optional fields
encrypt
- Encrypt fields list, primary keys can not be encrypted.index
- For the new ots index funtion, used when creating search indexes. You can create multiple indexes in a single table, and field_type of the same field can be different in different indexes. These field_types are supported: [:long, :double, :boolean, :keyword, :text, :nested, :geo_point].reserved_throughput_write
- Integer, table write performance data.reserved_throughput_read
- Integer, table read performance data.time_to_live
- Integer, live seconds of the table data stored.max_versions
- Integer, max versions of table.deviation_cell_version_in_sec
- Integer, Prohibit writing to data with large gap with expectations.stream_spec
- Keyword list, define stream specs of the table, two options are avaliable: a booleanenable_stream
and an integerexpiration_time
. For example: [enable_stream: true, expiration_time: 9999999999999]
Link to this section Summary
Functions
Create an index for your OTS table. One table can contain multiple indexes, use this function to create one at a time
Create an OTS table
Delete a search index of your OTS table
Delete your OTS table
Describe a search index of your OTS table
Describe your OTS table
List search indexes of your OTS table
Update your OTS table
Link to this section Types
field()
View Source
field() :: atom()
field() :: atom()
table()
View Source
table() :: struct()
table() :: struct()
Link to this section Functions
create_index(table, index_name) View Source
Create an index for your OTS table. One table can contain multiple indexes, use this function to create one at a time.
create_table(table) View Source
Create an OTS table.
You must create a table before you can interact with the table.
The only parameter table
is the module name of your table, the table
to generate will take the options when you use Otto.Table
.
Once created, the table's primary keys cannot change.
delete_search_index(table, index_name, opts \\ []) View Source
Delete a search index of your OTS table.
delete_table(table) View Source
Delete your OTS table.
describe_search_index(table, index_name, opts \\ []) View Source
Describe a search index of your OTS table.
describe_table(table) View Source
Describe your OTS table.
It will return table_meta, reserved_throughput_details, table_options, stream_specs, shared_splits info.
list_search_index(table, opts \\ []) View Source
List search indexes of your OTS table.
update_table(table) View Source
Update your OTS table.
OTS table's primary cannot be changed, you can update table_options,
stream_specs. All the params it takes are from your options when
using Otto.Table
.
Link to this section Callbacks
__schema__(atom)
View Source
__schema__(:fields) :: [atom()]
__schema__(:fields) :: [atom()]