Skip to main content

@rtorcato/db-common / onConflict

Function: onConflict()

onConflict(target, update?): OnConflict

Defined in: bulk.ts:39

Shape an upsert's ON CONFLICT clause: the target (unique) columns plus the update values to write when that key already exists, run through setClause so undefined is skipped and null is kept. An empty set means "do nothing on conflict".

onConflict(['email'], { name: 'Ada', bio: undefined }) // → { target: ['email'], set: [{ col: 'name', val: 'Ada' }] }

Parameters​

target​

string[]

update?​

Record<string, unknown> = {}

Returns​

OnConflict