EctoTablestore.Repo.insert
You're seeing just the callback
insert
, go back to EctoTablestore.Repo module for more information.
Specs
insert(schema_or_changeset(), options()) :: {:ok, schema()} | {:error, term()}
Inserts a struct defined via EctoTablestore.Schema or a changeset.
If a table defined an auto increment primary key which is processed in the server side, the server logic
MUST use condition(:ignore)
, in this case, this library internally forces to use condition(:ignore)
to :condition
option, so here we can omit the :condition
option when insert a row.
Options
:condition
, this option is required excepts that the table defined an auto increment primary key, whether to add conditional judgment before date insert.- As
condition(:ignore)
means DO NOT do any condition validation before insert, whether the row exists or not, both of the insert results will be success, if the schema non-partitioned primary key is auto increment, we can only usecondition(:ignore)
option. - As
condition(:expect_not_exist)
means expect the primary key(s) are NOT existed before insert, if the row is existed, the insert result will be fail, if the row is not existed, the insert result will be success. - As
condition(:expect_exist)
means overwrite the whole existed row to the primary key(s), if the row is existed, the insert result will be success, if the row is not existed, the insert result will be fail.
- As
:transaction_id
, insert under local transaction in a partition key.