mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-27 03:16:00 +00:00
single object analysis refactor
This commit is contained in:
@@ -26,6 +26,14 @@ export class DatabaseAnalyser {
|
|||||||
return this._runAnalysis();
|
return this._runAnalysis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async singleObjectAnalysis(name, typeField) {
|
||||||
|
this.singleObjectFilter = { ...name, typeField };
|
||||||
|
const res = this._runAnalysis();
|
||||||
|
if (res[typeField].length == 1) return res[typeField][0];
|
||||||
|
const obj = res[typeField].find(x => x.pureName == name.pureName && x.schemaName == name.schemaName);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
async incrementalAnalysis(structure) {
|
async incrementalAnalysis(structure) {
|
||||||
this.structure = structure;
|
this.structure = structure;
|
||||||
|
|
||||||
|
|||||||
@@ -22,12 +22,7 @@ export const driverBase = {
|
|||||||
},
|
},
|
||||||
async analyseSingleObject(pool, name, typeField = 'tables') {
|
async analyseSingleObject(pool, name, typeField = 'tables') {
|
||||||
const analyser = new this.analyserClass(pool, this);
|
const analyser = new this.analyserClass(pool, this);
|
||||||
analyser.singleObjectFilter = { ...name, typeField };
|
return analyser.singleObjectAnalysis(name, typeField);
|
||||||
const res = await analyser.fullAnalysis();
|
|
||||||
if (res[typeField].length == 1) return res[typeField][0];
|
|
||||||
const obj = res[typeField].find(x => x.pureName == name.pureName && x.schemaName == name.schemaName);
|
|
||||||
// console.log('FIND', name, obj);
|
|
||||||
return obj;
|
|
||||||
},
|
},
|
||||||
analyseSingleTable(pool, name) {
|
analyseSingleTable(pool, name) {
|
||||||
return this.analyseSingleObject(pool, name, 'tables');
|
return this.analyseSingleObject(pool, name, 'tables');
|
||||||
|
|||||||
Reference in New Issue
Block a user