graphile / crystal-pre-merge

Repository moved
https://github.com/graphile/crystal
39 stars 10 forks source link

Add rawClient to new NodePostgresPgClient subtype #464

Closed benjie closed 11 months ago

benjie commented 11 months ago

So the pgClient you get from withPgClient/withPgClientTransaction now has a .rawClient property you can use to get the underlying client from the pg module. This should allow you to use the @dataplan/pg/adaptors/pg adaptor with pgTyped and similar libraries:

const $books = withPgClient(executor, constant(null), async (pgClient) => {
  const books = await findBookById.run(
    { bookId: 5 },
    pgClient.rawClient, // < Don't forget to access .rawClient!
  );
  return books;
});