Skip to content

Commit e820e8a

Browse files
committed
f
1 parent 45ce6ac commit e820e8a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/operator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export abstract class Operator {
7777
// query(sql, values)
7878
if (this.beforeQueryHandlers.length > 0) {
7979
for (const beforeQueryHandler of this.beforeQueryHandlers) {
80-
const newSql = beforeQueryHandler(sql);
80+
const newSql = beforeQueryHandler(sql, values);
8181
if (newSql) {
8282
sql = newSql;
8383
}
@@ -119,7 +119,7 @@ export abstract class Operator {
119119
} as QueryEndMessage);
120120
if (this.afterQueryHandlers.length > 0) {
121121
for (const afterQueryHandler of this.afterQueryHandlers) {
122-
afterQueryHandler(sql, rows, duration, lastError);
122+
afterQueryHandler(sql, rows, duration, lastError, values);
123123
}
124124
}
125125
}

src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ export type LockTableOption = {
6363
tableAlias: string;
6464
};
6565

66-
export type BeforeQueryHandler = (sql: string) => string | undefined | void;
67-
export type AfterQueryHandler = (sql: string, result: any, execDuration: number, err?: Error) => void;
66+
export type BeforeQueryHandler = (sql: string, values?: object | any[]) => string | undefined | void;
67+
export type AfterQueryHandler = (sql: string, result: any, execDuration: number, err?: Error, values?: object | any[]) => void;
6868

6969
export type TransactionContext = Record<PropertyKey, RDSTransaction | null>;
7070
export type TransactionScope = (transaction: RDSTransaction) => Promise<any>;

0 commit comments

Comments
 (0)