|
|
|
@ -1,21 +1,24 @@
|
|
|
|
|
import { MetaService } from '../../../meta/meta.service' |
|
|
|
|
import SqlMgrv2 from './SqlMgrv2' |
|
|
|
|
import SqlMgrv2Trans from './SqlMgrv2Trans' |
|
|
|
|
import SqlMgrv2 from './SqlMgrv2'; |
|
|
|
|
import SqlMgrv2Trans from './SqlMgrv2Trans'; |
|
|
|
|
import type { MetaService } from '../../../meta/meta.service'; |
|
|
|
|
// import type NcMetaIO from '../../../meta/NcMetaIO';
|
|
|
|
|
import type Base from '../../../models/Base' |
|
|
|
|
import type Base from '../../../models/Base'; |
|
|
|
|
|
|
|
|
|
export default class ProjectMgrv2 { |
|
|
|
|
private static sqlMgrMap: { |
|
|
|
|
[key: string]: SqlMgrv2; |
|
|
|
|
} = {} |
|
|
|
|
} = {}; |
|
|
|
|
|
|
|
|
|
public static getSqlMgr(project: { id: string }, ncMeta: MetaService = null): SqlMgrv2 { |
|
|
|
|
if (ncMeta) return new SqlMgrv2(project, ncMeta) |
|
|
|
|
public static getSqlMgr( |
|
|
|
|
project: { id: string }, |
|
|
|
|
ncMeta: MetaService = null, |
|
|
|
|
): SqlMgrv2 { |
|
|
|
|
if (ncMeta) return new SqlMgrv2(project, ncMeta); |
|
|
|
|
|
|
|
|
|
if (!this.sqlMgrMap[project.id]) { |
|
|
|
|
this.sqlMgrMap[project.id] = new SqlMgrv2(project) |
|
|
|
|
this.sqlMgrMap[project.id] = new SqlMgrv2(project); |
|
|
|
|
} |
|
|
|
|
return this.sqlMgrMap[project.id] |
|
|
|
|
return this.sqlMgrMap[project.id]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static async getSqlMgrTrans( |
|
|
|
@ -24,8 +27,8 @@ export default class ProjectMgrv2 {
|
|
|
|
|
ncMeta: any, |
|
|
|
|
base: Base, |
|
|
|
|
): Promise<SqlMgrv2Trans> { |
|
|
|
|
const sqlMgr = new SqlMgrv2Trans(project, ncMeta, base) |
|
|
|
|
await sqlMgr.startTransaction(base) |
|
|
|
|
return sqlMgr |
|
|
|
|
const sqlMgr = new SqlMgrv2Trans(project, ncMeta, base); |
|
|
|
|
await sqlMgr.startTransaction(base); |
|
|
|
|
return sqlMgr; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|