mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #24009 from alex-sherwin/master
Existing "QueryResult" interface is missing property "fields"
This commit is contained in:
Vendored
+9
-9
@@ -53,13 +53,6 @@ export interface QueryArrayConfig extends QueryConfig {
|
||||
rowMode: 'array';
|
||||
}
|
||||
|
||||
export interface QueryResult {
|
||||
command: string;
|
||||
rowCount: number;
|
||||
oid: number;
|
||||
rows: any[];
|
||||
}
|
||||
|
||||
export interface FieldDef {
|
||||
name: string;
|
||||
tableID: number;
|
||||
@@ -70,14 +63,21 @@ export interface FieldDef {
|
||||
format: string;
|
||||
}
|
||||
|
||||
export interface QueryArrayResult {
|
||||
export interface QueryResultBase {
|
||||
command: string;
|
||||
rowCount: number;
|
||||
oid: number;
|
||||
rows: any[][];
|
||||
fields: FieldDef[];
|
||||
}
|
||||
|
||||
export interface QueryResult extends QueryResultBase {
|
||||
rows: any[];
|
||||
}
|
||||
|
||||
export interface QueryArrayResult extends QueryResultBase {
|
||||
rows: any[][];
|
||||
}
|
||||
|
||||
export interface Notification {
|
||||
processId: number;
|
||||
channel: string;
|
||||
|
||||
@@ -55,11 +55,13 @@ client.query(query, (err, res) => {
|
||||
console.error(err.stack);
|
||||
} else {
|
||||
console.log(res.rows);
|
||||
console.log(res.fields.map(f => f.name));
|
||||
}
|
||||
});
|
||||
client.query(query)
|
||||
.then(res => {
|
||||
console.log(res.rows);
|
||||
console.log(res.fields.map(f => f.name));
|
||||
})
|
||||
.catch(e => {
|
||||
console.error(e.stack);
|
||||
|
||||
Reference in New Issue
Block a user