create script callable from react

This commit is contained in:
Jan Prochazka
2020-02-03 20:34:38 +01:00
parent 680bed549f
commit 8a85cfe687
14 changed files with 147 additions and 95 deletions

View File

@@ -11,9 +11,10 @@ const dialect = {
/** @type {import('@dbgate/types').EngineDriver} */
const driver = {
async connect({pg}, { server, port, user, password, database }) {
const client = new pg.Client({ host: server, port, user, password, database: database || 'postgres' });
async connect(nativeModules, { server, port, user, password, database }) {
const client = new nativeModules.pg.Client({ host: server, port, user, password, database: database || 'postgres' });
await client.connect();
client._nativeModules = nativeModules;
return client;
},
async query(client, sql) {