smartdata/dist/smartdata.classes.db.d.ts

33 lines
1.1 KiB
TypeScript
Raw Normal View History

2016-09-11 16:01:46 +00:00
import * as plugins from './smartdata.plugins';
2016-09-13 20:53:21 +00:00
import { Objectmap } from 'lik';
import { DbCollection } from './smartdata.classes.dbcollection';
2016-11-17 11:20:52 +00:00
/**
* interface - indicates the connection status of the db
*/
2016-09-12 21:50:25 +00:00
export declare type TConnectionStatus = 'disconnected' | 'connected' | 'failed';
export declare class Db {
2016-09-11 16:01:46 +00:00
dbUrl: string;
2016-11-17 21:36:12 +00:00
db: plugins.mongodb.Db;
2016-09-12 21:50:25 +00:00
status: TConnectionStatus;
classCollections: Objectmap<DbCollection<any>>;
objectCollections: Objectmap<DbCollection<any>>;
2017-06-18 17:52:54 +00:00
constructor(dbUrlArg: string);
2016-09-13 20:53:21 +00:00
/**
* connects to the database that was specified during instance creation
*/
2017-06-18 17:52:54 +00:00
connect(): Promise<any>;
2016-09-13 20:53:21 +00:00
/**
* closes the connection to the databse
*/
2017-06-18 17:52:54 +00:00
close(): Promise<any>;
2016-09-13 20:53:21 +00:00
/**
* gets a class based collection by name: string
2016-09-13 20:53:21 +00:00
*/
getClassCollectionByName<T>(nameArg: string): Promise<DbCollection<T>>;
/**
* gets an object collection by name
*/
getObjectCollectionByName<T>(nameArg: string, dbArg: Db, makeNewArg?: boolean): Promise<DbCollection<T>>;
addCollection(dbCollectionArg: DbCollection<any>): void;
2016-09-11 16:01:46 +00:00
}