Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rawClient to new NodePostgresPgClient subtype #464

Merged
merged 3 commits into from
Aug 10, 2023
Merged

Conversation

benjie
Copy link
Member

@benjie benjie commented Aug 10, 2023

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;
});

…erty which is the underlying Postgres client for use with `pgTyped`, `zapatos`, and other libraries that can use a raw postgres client. This is exposed via `NodePostgresPgClient` interface which is a subtype of `PgClient`.
@benjie benjie added this to the V5 RC milestone Aug 10, 2023
@benjie benjie merged commit 4116b60 into main Aug 10, 2023
1 check passed
@benjie benjie deleted the pg-adaptor-client branch August 10, 2023 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant