ExAliyunOts.batch_write
You're seeing just the function
batch_write
, go back to ExAliyunOts module for more information.
Specs
Official document in Chinese | English
Example
import MyApp.TableStore
batch_write [
{"table1", [
write_delete([{"key1", 5}, {"key2", "5"}],
return_type: :pk,
condition: condition(:expect_exist, "attr1" == 5)),
write_put([{"key1", 6}, {"key2", "6"}],
[{"new_put_val1", "val1"}, {"new_put_val2", "val2"}],
condition: condition(:expect_not_exist),
return_type: :pk)
]},
{"table2", [
write_update([{"key1", "new_tab3_id2"}],
put: [{"new_put1", "u1"}, {"new_put2", 2.5}],
condition: condition(:expect_not_exist)),
write_put([{"key1", "new_tab3_id3"}],
[{"new_put1", "put1"}, {"new_put2", 10}],
condition: condition(:expect_not_exist))
]}
]
The batch write operation can be considered as a collection of multiple write_put/3
, write_update/2
and write_delete/2
operations.
Options
:transaction_id
, optional, batch write operation within local transaction.:is_atomic
, optional, defaults to false, whether set this batch write request be with an atomic operation, if this option istrue
, keep the partition key of each table in the batch write operation is unique, or the corresponding write operation of the table will fail.