ts-db-helper
Version:
Simple ORM based on TypeScript
35 lines (34 loc) • 971 B
TypeScript
import { TableConfig } from './configurator/table.configurator';
import { DbHelperModel } from '../models/db-helper-model.model';
/**
* @function Table
* Table annotation factory to add on class extending {@link DbHelperModel}.
* This annotation declares class in datamodel
*
* @example
* ```typescript
* @Table()
* export class Todo extends DbHelperModel {
*
* @PrimaryKey({autoIncremented: true})
* public id: number
*
* @Column()
* public name: string;
*
* @Column({type: 'long'})
* public dueDate: number;
* }
* ```
*
* @template T @extends DbHelperModel the target model
*
* @param {TableConfig} config, table configurator, informations are used to
* build DataModel.
*
* @return {Function} the annotation
*
* @author Olivier Margarit
* @since 0.1
*/
export declare function Table<T extends DbHelperModel>(config?: TableConfig): (target: new () => T) => void;