Module

x/kysely_postgrs_js_dialect/deps.ts>kysely.CamelCasePlugin#transformQuery

Kysely dialect for PostgreSQL using the Postgres.js client.
method kysely.CamelCasePlugin.prototype.transformQuery
import { kysely } from "https://dotland.deno.dev/x/kysely_postgrs_js_dialect@v0.27.3/deps.ts";
const { CamelCasePlugin } = kysely;

This is called for each query before it is executed. You can modify the query by transforming its OperationNode tree provided in {@link PluginTransformQueryArgs.node | args.node} and returning the transformed tree. You'd usually want to use an OperationNodeTransformer for this.

If you need to pass some query-related data between this method and transformResult you can use a WeakMap with {@link PluginTransformQueryArgs.queryId | args.queryId} as the key:

const plugin = {
  data: new WeakMap<QueryId, SomeData>(),

  transformQuery(args: PluginTransformQueryArgs): RootOperationNode {
    this.data.set(args.queryId, something)
    return args.node
  },

  transformResult(args: PluginTransformResultArgs): QueryResult<UnknownRow> {
    const data = this.data.get(args.queryId)
    return args.result
  }
}

You should use a WeakMap instead of a Map or some other strong references because transformQuery is not always matched by a call to transformResult which would leave orphaned items in the map and cause a memory leak.