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

fix(postgresql): use default export #63

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/connectors/postgresql.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Client, ClientConfig } from "pg";
import pg from "pg";

import type { Connector, Statement } from "../types";

export type ConnectorOptions = { url: string } | ClientConfig;
export type ConnectorOptions = { url: string } | pg.ClientConfig;

export default function postgresqlConnector(opts: ConnectorOptions) {
let _client: undefined | Client | Promise<Client>;
let _client: undefined | pg.Client | Promise<pg.Client>;
function getClient() {
if (_client) {
return _client;
}
const client = new Client("url" in opts ? opts.url : opts);
const client = new pg.Client("url" in opts ? opts.url : opts);

Check warning on line 13 in src/connectors/postgresql.ts

View check run for this annotation

Codecov / codecov/patch

src/connectors/postgresql.ts#L13

Added line #L13 was not covered by tests
_client = client.connect().then(() => {
_client = client;
return _client;
Expand Down