UNPKG

@smallprod/models

Version:
40 lines (39 loc) 1.74 kB
import Entity from '../entity'; export declare function Table(tableName: string): <T extends { new (...args: any[]): Entity; ready: boolean; create: () => any; tableName: string; autoCreateNUpdate: boolean; }>(constructor: T) => { new (...args: any[]): { persisted: boolean; relations: any[]; create: (dbName?: string | null, context?: import("../entitymanager").Context | undefined) => Promise<any | null>; update: (dbName?: string | null) => Promise<any | null>; delete: (dbName?: string | null, context?: import("../entitymanager").Context | undefined) => Promise<boolean>; fetch: (field: string, context?: import("../entitymanager").Context | undefined) => Promise<void>; }; ready: boolean; create: () => any; tableName: string; autoCreateNUpdate: boolean; } & T; export declare function AutoCreateNUpdate(): <T extends { new (...args: any[]): Entity; autoCreateNUpdate: boolean; tableName: string; }>(constructor: T) => { new (...args: any[]): { persisted: boolean; relations: any[]; create: (dbName?: string | null, context?: import("../entitymanager").Context | undefined) => Promise<any | null>; update: (dbName?: string | null) => Promise<any | null>; delete: (dbName?: string | null, context?: import("../entitymanager").Context | undefined) => Promise<boolean>; fetch: (field: string, context?: import("../entitymanager").Context | undefined) => Promise<void>; }; autoCreateNUpdate: boolean; tableName: string; } & T; export declare function NonPersistent(): (target: any, key: string) => void; export declare function Id(): (target: any, key: string) => void;