(name, { where, ...options })
| 347 | return await internal.count(table, { where: constrainedWhere }); |
| 348 | }, |
| 349 | async upsert(name, { where, ...options }) { |
| 350 | const table = toTable(name); |
| 351 | const conditions = where ? buildCondition(table.columns, where) : undefined; |
| 352 | if (conditions === false) return; |
| 353 | let compiledWhere: Condition | undefined | false = conditions === true ? undefined : conditions; |
| 354 | |
| 355 | compiledWhere = await applyUpdatePolicies( |
| 356 | table, |
| 357 | compiledWhere, |
| 358 | options.update, |
| 359 | context, |
| 360 | "upsert", |
| 361 | options.create, |
| 362 | ); |
| 363 | if (compiledWhere === false) return; |
| 364 | await runCreatePolicies(table, options.create, context); |
| 365 | await internal.upsert(table, { |
| 366 | where: compiledWhere, |
| 367 | ...options, |
| 368 | }); |
| 369 | }, |
| 370 | async create(name, values) { |
| 371 | const table = toTable(name); |
| 372 | await runCreatePolicies(table, values, context); |
nothing calls this directly
no test coverage detected