Skip to content

Commit

Permalink
Add query as final argument to resultListener (addresses #181)
Browse files Browse the repository at this point in the history
  • Loading branch information
jawj committed Oct 2, 2024
1 parent 505c7b9 commit 2128797
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/db/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Config>;
Expand Down
2 changes: 1 addition & 1 deletion src/db/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export class SQLFragment<RunResult = pg.QueryResult['rows'], Constraint = never>
result = this.noopResult;
}

if (resultListener) resultListener(result, txnId, timing() - startMs!);
if (resultListener) resultListener(result, txnId, timing() - startMs!, query);
return result;
};

Expand Down

0 comments on commit 2128797

Please sign in to comment.