(db: Kysely<any>)
| 92 | } |
| 93 | |
| 94 | async function testKyselyAnyUpdates(db: Kysely<any>) { |
| 95 | const r1 = await db |
| 96 | .updateTable('foo') |
| 97 | .set({ bar: 'baz', spam: 1 }) |
| 98 | .where('foo.eggs', '=', 1) |
| 99 | .executeTakeFirstOrThrow() |
| 100 | expectType<UpdateResult>(r1) |
| 101 | |
| 102 | const r2 = await db |
| 103 | .updateTable('foo as f') |
| 104 | .set({ bar: 'baz', spam: 1 }) |
| 105 | .where('f.eggs', '=', 1) |
| 106 | .where('spam', '=', 2) |
| 107 | .executeTakeFirstOrThrow() |
| 108 | expectType<UpdateResult>(r2) |
| 109 | |
| 110 | const r3 = await db |
| 111 | .updateTable('foo') |
| 112 | .set({ bar: 'baz', spam: 1 }) |
| 113 | .where('foo.eggs', '=', 1) |
| 114 | .where('spam', '=', 2) |
| 115 | .returning(['a', 'b']) |
| 116 | .executeTakeFirstOrThrow() |
| 117 | expectType<{ a: any; b: any }>(r3) |
| 118 | |
| 119 | const r4 = await db |
| 120 | .updateTable('foo') |
| 121 | .set((eb) => ({ |
| 122 | foo: eb('foo.bar', '=', 1), |
| 123 | })) |
| 124 | .where('foo.eggs', '=', 1) |
| 125 | .executeTakeFirstOrThrow() |
| 126 | expectType<UpdateResult>(r4) |
| 127 | |
| 128 | const table: 'foo' | 'bar' = Math.random() > 0.5 ? 'foo' : 'bar' |
| 129 | const r5 = await db |
| 130 | .updateTable(table) |
| 131 | .set((eb) => ({ |
| 132 | foo: eb('foo.bar', '=', 1), |
| 133 | })) |
| 134 | .where('foo.eggs', '=', 1) |
| 135 | .executeTakeFirstOrThrow() |
| 136 | expectType<UpdateResult>(r5) |
| 137 | } |
| 138 | |
| 139 | async function testKyselyAnyDeletes(db: Kysely<any>) { |
| 140 | const r1 = await db |
nothing calls this directly
no test coverage detected
searching dependent graphs…