new upsert(table, uuid, record, options) → {Operation}
Insert or update a record using ON CONFLICT UPDATE
Parameters:
Name | Type | Description |
---|---|---|
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
upsert(
'users', // the DB table
'ON CONSTRAINT users_pkey', // a DB column with a unique constraint OR a CONSTRAINT NAME
{ name: 'Elodie', id: 7 },
{ setNull: ["''", "'undefined'"], writeSql:true, execute: true, logValues: true }
)