mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
generate script menu for collections
This commit is contained in:
parent
90169a7624
commit
cc2c55b20f
@ -206,6 +206,17 @@
|
|||||||
label: 'Export',
|
label: 'Export',
|
||||||
isExport: true,
|
isExport: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
divider: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'JS: dropCollection()',
|
||||||
|
scriptTemplate: 'dropCollection',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'JS: find()',
|
||||||
|
scriptTemplate: 'findCollection',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -45,6 +45,12 @@ export default async function applyScriptTemplate(scriptTemplate, extensions, pr
|
|||||||
if (procedureInfo) dmp.put('^execute %f', procedureInfo);
|
if (procedureInfo) dmp.put('^execute %f', procedureInfo);
|
||||||
return dmp.s;
|
return dmp.s;
|
||||||
}
|
}
|
||||||
|
if (scriptTemplate == 'dropCollection') {
|
||||||
|
return `db.collection('${props.pureName}').drop()`;
|
||||||
|
}
|
||||||
|
if (scriptTemplate == 'findCollection') {
|
||||||
|
return `db.collection('${props.pureName}').find()`;
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user