(name, { where, ...options })
| 425 | return await internal.count(table, { where: constrainedWhere }); |
| 426 | }, |
| 427 | async upsert(name, { where, ...options }) { |
| 428 | const table = toTable(name); |
| 429 | const conditions = where ? buildCondition(table.columns, where) : undefined; |
| 430 | if (conditions === false) return; |
| 431 | let compiledWhere: Condition | undefined | false = conditions === true ? undefined : conditions; |
| 432 | |
| 433 | compiledWhere = await applyUpdatePolicies( |
| 434 | table, |
| 435 | compiledWhere, |
| 436 | options.update, |
| 437 | context, |
| 438 | "upsert", |
| 439 | options.create, |
| 440 | ); |
| 441 | if (compiledWhere === false) return; |
| 442 | await runCreatePolicies(table, options.create, context); |
| 443 | await internal.upsert(table, { |
| 444 | where: compiledWhere, |
| 445 | ...options, |
| 446 | }); |
| 447 | }, |
| 448 | async upsertMany(name, { target, update, values }) { |
| 449 | const table = toTable(name); |
| 450 | if (values.length === 0) return; |
nothing calls this directly
no test coverage detected