mong support WIP

This commit is contained in:
Jan Prochazka
2021-04-02 18:40:07 +02:00
parent d4bd6e03c9
commit 394c6028c9
19 changed files with 347 additions and 10 deletions

View File

@@ -92,6 +92,13 @@ module.exports = {
return res;
},
collectionData_meta: 'post',
async collectionData({ conid, database, options }) {
const opened = await this.ensureOpened(conid, database);
const res = await this.sendRequest(opened, { msgtype: 'collectionData', options });
return res;
},
status_meta: 'get',
async status({ conid, database }) {
const existing = this.opened.find(x => x.conid == conid && x.database == database);

View File

@@ -17,7 +17,7 @@ module.exports = {
listObjects_meta: 'get',
async listObjects({ conid, database }) {
const opened = await databaseConnections.ensureOpened(conid, database);
const types = ['tables', 'views', 'procedures', 'functions', 'triggers'];
const types = ['tables', 'collections', 'views', 'procedures', 'functions', 'triggers'];
return types.reduce(
(res, type) => ({
...res,

View File

@@ -94,6 +94,17 @@ async function handleQueryData({ msgid, sql }) {
}
}
async function handleCollectionData({ msgid, options }) {
await waitConnected();
const driver = requireEngineDriver(storedConnection);
try {
const result = await driver.readCollection(systemConnection, options);
process.send({ msgtype: 'response', msgid, result });
} catch (err) {
process.send({ msgtype: 'response', msgid, errorMessage: err.message });
}
}
async function handleSqlPreview({ msgid, objects, options }) {
await waitConnected();
const driver = requireEngineDriver(storedConnection);
@@ -129,6 +140,7 @@ function handlePing() {
const messageHandlers = {
connect: handleConnect,
queryData: handleQueryData,
collectionData: handleCollectionData,
sqlPreview: handleSqlPreview,
ping: handlePing,
// runCommand: handleRunCommand,