show table data

This commit is contained in:
Jan Prochazka
2020-01-25 17:26:51 +01:00
parent 2a40b05ae0
commit 73bcfaeb36
13 changed files with 112 additions and 43 deletions

View File

@@ -8,15 +8,15 @@ module.exports = {
},
async query(client, sql) {
const res = await client.query(sql);
return res.rows;
return { rows: res.rows };
},
async getVersion(client) {
const rows = await this.query(client, 'SELECT version()');
const { rows } = await this.query(client, 'SELECT version()');
const { version } = rows[0];
return { version };
},
async listDatabases(client) {
const res = await this.query(client, 'SELECT datname AS name FROM pg_database WHERE datistemplate = false');
return res;
const { rows } = await this.query(client, 'SELECT datname AS name FROM pg_database WHERE datistemplate = false');
return rows;
},
};