You're seeing just the function update_row, go back to ExAliyunOts module for more information.
Link to this function

update_row(instance, table_name, primary_keys, options \\ [])

View Source


update_row(instance(), table_name(), primary_keys(), options()) :: result()

Official document in Chinese | English


import MyApp.TableStore

value = "1"
update_row "table1",
  [{"key1", 2}, {"key2", "2"}],
  delete: [{"attr2", nil, 1524464460}],
  delete_all: ["attr1"],
  put: [{"attr3", "put_attr3"}],
  return_type: :pk,
  condition: condition(:expect_exist, "attr2" == value)

update_row "table2",
  [{"key1", 1}],
  put: [{"attr1", "put_attr1"}],
  increment: [{"count", 1}],
  return_type: :after_modify,
  return_columns: ["count"],
  condition: condition(:ignore)

update_row "table3",
  put: [{"new_attr1", "a1"}],
  delete_all: ["level", "size"],
  condition: condition(:ignore),
  transaction_id: "transaction_id"


  • :put, optional, require to be valid value, e.g. [{"field1", "value"}, {...}], insert a new column if this field is not existed, or overwrite this field if existed.
  • :delete, optional, delete the special version of a column or columns, please pass the column's version (timestamp) in :delete option, e.g. [{"field1", nil, 1524464460}, ...].
  • :delete_all, optional, delete all versions of a column or columns, e.g. ["field1", "field2", ...].
  • :increment, optional, attribute column(s) base on atomic counters for increment or decrement, require the value of column is integer.
    • for increment, increment: [{"count", 1}];
    • for decrement, increment: [{"count", -1}].
  • :return_type, optional, whether return the primary keys after update row, available options are :pk | :none | :after_modify, by default it is :none.
    • if use atomic counters, must set return_type: :after_modify.
  • :condition, required, please see condition/1 or condition/2 for details.
  • :transaction_id, optional, write operation within local transaction.