这是indexloc提供的服务,不要输入任何密码
Skip to content

Support where clause parameter on insert mutation on_conflict #2795

@wneild

Description

@wneild

We have a use case where we want to upsert entries but in the case of an update, the row is only affected if it meets a certain condition, e.g. the timestamp of the new data is greater than the timestamp of the old.

An example query might look like:

mutation {
  insert_item(
    objects: {itemId:"1234", creationEpochSeconds: 1567026834},
    on_conflict: {
    	constraint: item_pkey,
        update_columns: [itemId, creationEpochSeconds]
        where: {creationEpochSeconds: {_lt: 1567026834 }}
    }) {
    affected_rows
  }
}

Metadata

Metadata

Assignees

Labels

c/serverRelated to serverk/enhancementNew feature or improve an existing feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions