@rtorcato/db-common / pickMany
Function: pickMany()
pickMany(
rows,keys):BulkInsertShape
Defined in: bulk.ts:19
Pick keys off many objects into one shared columns list and a parallel
rows matrix for a multi-row INSERT. Write-side sibling of pick. A key is
dropped only when it is undefined in every row; if some rows set it, the
column stays and the rows that left it unset carry undefined (map it to
DEFAULT). A null is kept as a NULL write.
pickMany([{ name: 'Ada', bio: undefined }, { name: 'Bo', bio: null }], ['name', 'bio']) // → { columns: ['name', 'bio'], rows: [['Ada', undefined], ['Bo', null]] }
Parameters
rows
Record<string, unknown>[]
keys
string[]