2025-04-06 13:49:56 +00:00
|
|
|
import * as plugins from './plugins.js';
|
|
|
|
|
import { SmartdataCollection } from './classes.collection.js';
|
|
|
|
|
import { SmartdataDb } from './classes.db.js';
|
2020-09-10 10:12:17 +00:00
|
|
|
|
|
|
|
|
export class CollectionFactory {
|
2020-10-19 16:44:28 +00:00
|
|
|
public collections: { [key: string]: SmartdataCollection<any> } = {};
|
2020-09-10 10:12:17 +00:00
|
|
|
|
2021-10-16 21:17:02 +02:00
|
|
|
public getCollection = (nameArg: string, dbArg: SmartdataDb): SmartdataCollection<any> => {
|
2025-11-28 07:53:15 +00:00
|
|
|
if (!this.collections[nameArg] && dbArg instanceof SmartdataDb) {
|
|
|
|
|
this.collections[nameArg] = new SmartdataCollection(nameArg, dbArg);
|
2020-09-10 10:12:17 +00:00
|
|
|
}
|
|
|
|
|
return this.collections[nameArg];
|
2020-10-19 16:44:28 +00:00
|
|
|
};
|
|
|
|
|
}
|