diff --git a/src/db/config.ts b/src/db/config.ts index bbe2341..1a0d16e 100644 --- a/src/db/config.ts +++ b/src/db/config.ts @@ -16,7 +16,7 @@ export interface Config { castArrayParamsToJson: boolean; // see https://github.com/brianc/node-postgres/issues/2012 castObjectParamsToJson: boolean; // useful if json will be cast onward differently from text queryListener?(query: SQLQuery, txnId?: number): void; - resultListener?(result: any, txnId?: number, elapsedMs?: number): void; + resultListener?(result: any, txnId?: number, elapsedMs?: number, query?: SQLQuery): void; transactionListener?(message: string, txnId?: number): void; } export type NewConfig = Partial; diff --git a/src/db/core.ts b/src/db/core.ts index 5d0e9b0..cb82475 100644 --- a/src/db/core.ts +++ b/src/db/core.ts @@ -280,7 +280,7 @@ export class SQLFragment result = this.noopResult; } - if (resultListener) resultListener(result, txnId, timing() - startMs!); + if (resultListener) resultListener(result, txnId, timing() - startMs!, query); return result; };