| 
									
										
										
										
											2016-09-11 18:01:46 +02:00
										 |  |  | /// <reference types="q" />
 | 
					
						
							|  |  |  | import * as plugins from './smartdata.plugins'; | 
					
						
							| 
									
										
										
										
											2016-09-13 22:53:21 +02:00
										 |  |  | import { Objectmap } from 'lik'; | 
					
						
							|  |  |  | import { DbCollection } from './smartdata.classes.dbcollection'; | 
					
						
							| 
									
										
										
										
											2016-11-17 12:20:52 +01:00
										 |  |  | /** | 
					
						
							|  |  |  |  * interface - indicates the database type | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | export declare type TDbType = 'mongodb' | 'nedb'; | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * interface - indicates the connection status of the db | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-12 23:50:25 +02:00
										 |  |  | export declare type TConnectionStatus = 'disconnected' | 'connected' | 'failed'; | 
					
						
							|  |  |  | export declare class Db { | 
					
						
							| 
									
										
										
										
											2016-11-17 12:20:52 +01:00
										 |  |  |     dbType: TDbType; | 
					
						
							| 
									
										
										
										
											2016-09-11 18:01:46 +02:00
										 |  |  |     dbUrl: string; | 
					
						
							| 
									
										
										
										
											2016-11-17 22:36:12 +01:00
										 |  |  |     db: plugins.mongodb.Db; | 
					
						
							| 
									
										
										
										
											2016-09-12 23:50:25 +02:00
										 |  |  |     status: TConnectionStatus; | 
					
						
							| 
									
										
										
										
											2016-09-13 22:53:21 +02:00
										 |  |  |     collections: Objectmap<DbCollection<any>>; | 
					
						
							| 
									
										
										
										
											2016-11-17 12:20:52 +01:00
										 |  |  |     constructor(dbUrlArg: string, dbTypeArg?: TDbType); | 
					
						
							| 
									
										
										
										
											2016-09-13 22:53:21 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * connects to the database that was specified during instance creation | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-09-11 18:01:46 +02:00
										 |  |  |     connect(): plugins.q.Promise<any>; | 
					
						
							| 
									
										
										
										
											2016-09-13 22:53:21 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * closes the connection to the databse | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-09-11 18:01:46 +02:00
										 |  |  |     close(): plugins.q.Promise<any>; | 
					
						
							| 
									
										
										
										
											2016-09-13 22:53:21 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * gets a collection by name: string | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     getCollectionByName<T>(nameArg: string): plugins.q.Promise<DbCollection<T>>; | 
					
						
							| 
									
										
										
										
											2016-09-14 01:02:11 +02:00
										 |  |  |     addCollection(dbCollectionArg: DbCollection<any>): void; | 
					
						
							| 
									
										
										
										
											2016-09-11 18:01:46 +02:00
										 |  |  | } |