(table, v)
| 167 | } |
| 168 | }, |
| 169 | async upsert(table, v) { |
| 170 | const existing = tableRows(db, table).find((row) => matchesCondition(row, v.where)); |
| 171 | if (existing) { |
| 172 | Object.assign(existing, cloneValue(v.update)); |
| 173 | return; |
| 174 | } |
| 175 | await this.create(table, v.create); |
| 176 | }, |
| 177 | async create(table, values) { |
| 178 | const row = applyDefaults(table, values); |
| 179 | tableRows(db, table).push(row); |
nothing calls this directly
no test coverage detected