smartdata/dist/smartdata.classes.dbdoc.d.ts

35 lines
931 B
TypeScript
Raw Normal View History

2016-09-13 20:53:21 +00:00
import { DbCollection } from './smartdata.classes.dbcollection';
export declare type TDocCreation = 'db' | 'data' | 'mixed';
2016-11-17 23:42:25 +00:00
/**
* sva - saveable decorator to be used on class properties
*/
export declare function saveable(target: DbDoc<any>, key: string): void;
2016-09-13 20:53:21 +00:00
export declare class DbDoc<T> {
2016-11-17 23:42:25 +00:00
/**
* the collection object an Doc belongs to
*/
2016-09-13 20:53:21 +00:00
collection: DbCollection<T>;
2016-11-17 23:42:25 +00:00
/**
* how the Doc in memory was created, may prove useful later.
*/
2016-09-13 20:53:21 +00:00
creationType: TDocCreation;
2016-11-17 23:42:25 +00:00
/**
* an array of saveable properties of a doc
*/
saveableProperties: string[];
/**
* class constructor
*/
constructor();
2016-11-17 23:42:25 +00:00
/**
* saves this instance but not any connected items
* may lead to data inconsistencies, but is faster
*/
2016-09-13 20:53:21 +00:00
save(): void;
2016-11-17 23:42:25 +00:00
/**
* also store any referenced objects to DB
* better for data consistency
*/
2016-09-13 20:53:21 +00:00
saveDeep(): void;
}