Skip to content

Commit ffa3bf7

Browse files
committed
leave some todos for savepoint implementation.
1 parent 697b94d commit ffa3bf7

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

src/driver.mts

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
CompiledQuery,
33
type DatabaseConnection,
44
type Driver,
5+
type QueryCompiler,
56
type QueryResult,
67
type TransactionSettings,
78
} from 'kysely'
@@ -38,23 +39,47 @@ export class PostgresJSDriver implements Driver {
3839
await connection.commitTransaction()
3940
}
4041

42+
async destroy(): Promise<void> {
43+
// biome-ignore lint/style/noNonNullAssertion: `init` ran at this point.
44+
await this.#postgres!.end()
45+
}
46+
4147
async init(): Promise<void> {
4248
const { postgres } = this.#config
4349

4450
this.#postgres = isPostgresJSSql(postgres) ? postgres : await postgres()
4551
}
4652

47-
async rollbackTransaction(connection: PostgresJSConnection): Promise<void> {
48-
await connection.rollbackTransaction()
49-
}
50-
5153
async releaseConnection(connection: PostgresJSConnection): Promise<void> {
5254
connection.releaseConnection()
5355
}
5456

55-
async destroy(): Promise<void> {
56-
// biome-ignore lint/style/noNonNullAssertion: `init` ran at this point.
57-
await this.#postgres!.end()
57+
releaseSavepoint(
58+
connection: DatabaseConnection,
59+
savepointName: string,
60+
compileQuery: QueryCompiler['compileQuery'],
61+
): Promise<void> {
62+
// TODO: ...
63+
}
64+
65+
rollbackToSavepoint(
66+
connection: DatabaseConnection,
67+
savepointName: string,
68+
compileQuery: QueryCompiler['compileQuery'],
69+
): Promise<void> {
70+
// TODO: ...
71+
}
72+
73+
async rollbackTransaction(connection: PostgresJSConnection): Promise<void> {
74+
await connection.rollbackTransaction()
75+
}
76+
77+
savepoint(
78+
connection: DatabaseConnection,
79+
savepointName: string,
80+
compileQuery: QueryCompiler['compileQuery'],
81+
): Promise<void> {
82+
// TODO: ...
5883
}
5984
}
6085

0 commit comments

Comments
 (0)