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

45 lines
1.1 KiB
TypeScript
Raw Normal View History

2017-07-15 22:11:03 +00:00
import { Objectmap } from 'lik';
import { DbTable } from './smartdata.classes.dbcollection';
2017-07-15 22:11:03 +00:00
export declare type TDocCreation = 'db' | 'new' | 'mixed';
/**
* saveable - saveable decorator to be used on class properties
*/
export declare function svDb(): (target: DbDoc<any>, key: string) => void;
export declare class DbDoc<T> {
/**
* the collection object an Doc belongs to
*/
collection: DbTable<T>;
2017-07-15 22:11:03 +00:00
/**
* how the Doc in memory was created, may prove useful later.
*/
creationStatus: TDocCreation;
2017-07-15 22:11:03 +00:00
/**
* an array of saveable properties of a doc
*/
saveableProperties: string[];
/**
* name
*/
name: string;
/**
* primary id in the database
*/
dbId: string;
2017-07-15 22:11:03 +00:00
/**
* class constructor
*/
constructor();
/**
* saves this instance but not any connected items
* may lead to data inconsistencies, but is faster
*/
save(): Promise<void>;
2017-07-15 22:11:03 +00:00
/**
* also store any referenced objects to DB
* better for data consistency
*/
saveDeep(savedMapArg?: Objectmap<DbDoc<any>>): void;
createSavableObject(): any;
2017-07-15 22:11:03 +00:00
}