Class: upsertIf

Adaptor~upsertIf(logical, table, uuid, record, options) → {Operation}

new upsertIf(logical, table, uuid, record, options) → {Operation}

Insert or update a record based on a logical condition using ON CONFLICT UPDATE
Parameters:
Name Type Description
logical string a data to check existing value for.
table string The target table
uuid string The uuid column to determine a matching/existing record
record object Payload data for the record as a JS object or function
options object Optional options argument
Source:
Returns:
Type
Operation
Example
upsertIf(
  dataValue('name'),
  'users', // the DB table
  'ON CONSTRAINT users_pkey', // a DB column with a unique constraint OR a CONSTRAINT NAME
  { name: 'Elodie', id: 7 },
  { writeSql:true, execute: true }
)