dialect, dumper

This commit is contained in:
Jan Prochazka
2020-02-02 19:27:25 +01:00
parent 9f3679fefb
commit 6188e90340
18 changed files with 294 additions and 10 deletions

View File

@@ -1,5 +1,13 @@
const { Client } = require('pg');
/** @type {import('dbgate').SqlDialect} */
const dialect = {
rangeSelect: true,
quoteIdentifier(s) {
return '"' + s + '"';
},
};
module.exports = {
async connect({ server, port, user, password, database }) {
const client = new Client({ host: server, port, user, password, database: database || 'postgres' });
@@ -19,4 +27,5 @@ module.exports = {
const { rows } = await this.query(client, 'SELECT datname AS name FROM pg_database WHERE datistemplate = false');
return rows;
},
dialect,
};