2016-09-11 16:01:46 +00:00
|
|
|
/// <reference types="q" />
|
|
|
|
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-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;
|
|
|
|
db: plugins.mongodb.Db;
|
2016-09-12 21:50:25 +00:00
|
|
|
status: TConnectionStatus;
|
2016-09-13 20:53:21 +00:00
|
|
|
collections: Objectmap<DbCollection<any>>;
|
2016-09-11 16:01:46 +00:00
|
|
|
constructor(dbUrl: string);
|
2016-09-13 20:53:21 +00:00
|
|
|
/**
|
|
|
|
* connects to the database that was specified during instance creation
|
|
|
|
*/
|
2016-09-11 16:01:46 +00:00
|
|
|
connect(): plugins.q.Promise<any>;
|
2016-09-13 20:53:21 +00:00
|
|
|
/**
|
|
|
|
* closes the connection to the databse
|
|
|
|
*/
|
2016-09-11 16:01:46 +00:00
|
|
|
close(): plugins.q.Promise<any>;
|
2016-09-13 20:53:21 +00:00
|
|
|
/**
|
|
|
|
* gets a collection by name: string
|
|
|
|
*/
|
|
|
|
getCollectionByName<T>(nameArg: string): plugins.q.Promise<DbCollection<T>>;
|
2016-09-11 16:01:46 +00:00
|
|
|
}
|