Skip to content

IDatabaseConnection is not compatible with pg anymore #599

@ldrick

Description

@ldrick

Describe the bug
This is the new Type of IDatabaseConnection:

export interface IDatabaseConnection {
    query: (query: string, bindings: any[]) => Promise<{
        rows: any[];
        rowCount: number;
    }>;
    stream?: (query: string, bindings: any[]) => ICursor<any[]>;
}

where pg still uses this Type for QueryResultBase which is the base for returns of Pool.query and Client.query:

export interface QueryResultBase {
    command: string;
    rowCount: number | null;
    oid: number;
    fields: FieldDef[];
}

export interface QueryResultRow {
    [column: string]: any;
}

export interface QueryResult<R extends QueryResultRow = any> extends QueryResultBase {
    rows: R[];
}

Expected behavior
Could IDatabaseConnection please be compatible to pgagain, by having rowCount nullable?

Test case

If applicable, it would really help if you can add an end-to-end test-case to the packages/example project.

The package allows you to do the following:

  • Modify the database schema at packages/example/sql/schema.sql.
  • Define your SQL query as a .ts or .sql anywhere in the packages/example/src directory.
  • Run your SQL as a Jest test case in packages/example/src/index.test.ts

Please refer to contributing.md for details on how to run the example package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions