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

40 lines
1.0 KiB
TypeScript
Raw Normal View History

2017-02-25 11:37:05 +01:00
import { Objectmap } from 'lik';
2016-09-13 22:53:21 +02:00
import { DbCollection } from './smartdata.classes.dbcollection';
2016-11-18 00:59:57 +01:00
export declare type TDocCreation = 'db' | 'new' | 'mixed';
2016-11-18 00:42:25 +01:00
/**
2016-11-18 13:20:43 +01:00
* saveable - saveable decorator to be used on class properties
2016-11-18 00:42:25 +01:00
*/
2016-11-18 13:56:15 +01:00
export declare function svDb(): (target: DbDoc<any>, key: string) => void;
2016-09-13 22:53:21 +02:00
export declare class DbDoc<T> {
2016-11-18 00:42:25 +01:00
/**
* the collection object an Doc belongs to
*/
2016-09-13 22:53:21 +02:00
collection: DbCollection<T>;
2016-11-18 00:42:25 +01:00
/**
* how the Doc in memory was created, may prove useful later.
*/
2016-09-13 22:53:21 +02:00
creationType: TDocCreation;
2016-11-18 00:42:25 +01:00
/**
* an array of saveable properties of a doc
*/
saveableProperties: string[];
2017-06-18 19:52:54 +02:00
/**
* name
*/
name: string;
2016-11-18 00:42:25 +01:00
/**
* class constructor
*/
constructor();
2016-11-18 00:42:25 +01:00
/**
* saves this instance but not any connected items
* may lead to data inconsistencies, but is faster
*/
2016-09-13 22:53:21 +02:00
save(): void;
2016-11-18 00:42:25 +01:00
/**
* also store any referenced objects to DB
* better for data consistency
*/
2017-02-25 11:37:05 +01:00
saveDeep(savedMapArg?: Objectmap<DbDoc<any>>): void;
2016-09-13 22:53:21 +02:00
}