EctoTablestore.Repo.update

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

update(changeset, options)

View Source

Specs

update(changeset :: Ecto.Changeset.t(), options()) ::
  {:ok, schema()} | {:error, term()}

Updates a changeset using its primary key.

Options

  • :condition, this option is required, whether to add conditional judgment before data update.

    Two kinds of update condition types as below: As condition(:expect_exist) means the primary key(s) can match a row to update, we also can add some compare expressions for the attribute columns, e.g.

    1. condition(:expect_exist, "attr1" == value1 and "attr2" > 1)
    2. condition(:expect_exist, "attr1" != value1)
    3. condition(:expect_exist, "attr1" > 100 or "attr2" < 1000) As condition(:ignore) means DO NOT do any condition validation before update.
  • :transaction_id, update under local transaction in a partition key.

  • :stale_error_field - The field where stale errors will be added in the returning changeset. This option can be used to avoid raising Ecto.StaleEntryError.

  • :stale_error_message - The message to add to the configured :stale_error_field when stale errors happen, defaults to "is stale".

  • :returning, this option is required when the input changeset with :increment operation, all fields of the atomic increment operation are required to explicitly set into this option in any order, if missed any atomic increment operation related field, there will raise an Ecto.ConstraintError to prompt and terminate this update. If there is no :increment operation, the :returning option is no need to set. If set returning: true, but not really all fields are changed, the unchanged fields will be replaced as nil in the returned schema data.