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

40 lines
1.0 KiB
TypeScript
Raw Normal View History

2017-02-25 10:37:05 +00:00
import { Objectmap } from 'lik';
2016-09-13 20:53:21 +00:00
import { DbCollection } from './smartdata.classes.dbcollection';
2016-11-17 23:59:57 +00:00
export declare type TDocCreation = 'db' | 'new' | 'mixed';
2016-11-17 23:42:25 +00:00
/**
2016-11-18 12:20:43 +00:00
* saveable - saveable decorator to be used on class properties
2016-11-17 23:42:25 +00:00
*/
2016-11-18 12:56:15 +00:00
export declare function svDb(): (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[];
2017-06-18 17:52:54 +00:00
/**
* name
*/
name: string;
2016-11-17 23:42:25 +00:00
/**
* 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
*/
2017-02-25 10:37:05 +00:00
saveDeep(savedMapArg?: Objectmap<DbDoc<any>>): void;
2016-09-13 20:53:21 +00:00
}