ts-db-helper
Version:
Simple ORM based on TypeScript
103 lines (102 loc) • 2.75 kB
TypeScript
import { ColumnConfig } from '../../decorators/configurator/column.configurator';
/**
* @public
* @class DbColumn
*
* @description
* This class is a column model
* to help model migration to do his soup
*
* @author Olivier Margarit
* @since 0.1
*/
export declare class DbColumn {
/**
* @public
* @property {string} name, the optional column name, if not set, the column take
* the field name as column name
*/
name: string;
/**
* @public
* @property {string} field field name form the declared model
*/
field: string;
/**
* @public
* @property {boolean} primaryKey define the column as primary key of the table,
* the default value is false
*/
primaryKey: boolean;
/**
* @public
* @property {boolean} autoIncrement define if the column value is auto incremented
* default value is false
*/
autoIncrement: boolean;
/**
* @public
* @property {boolean} unique define if column value should be unique. Default value
* is false
*/
unique: boolean;
/**
* @public
* @property {boolean} indexed define if column value should be indexed. Default value
* is false
*/
indexed: boolean;
/**
* @public
* @property {string} type define type of the column, type must be compatible with
* the field type plus the sqlite manged type
*/
type: string;
/**
* @public
* @property {string} foreignTable foreign table name
*/
foreignTable: string | null;
/**
* @public
* @property {string} foreignKey foreign key linked to current key
*/
foreignKey: string | null;
/**
* @public
* @property {string} foreignField field name of the foreign model
*/
foreignField: string | null;
/**
* @public
* @property {any} defaultValue the default value of the column
*/
defaultValue: any;
/**
* @public
* @constructor Create column instance
*
* @param {string} name column name
*/
constructor(name?: string);
/**
* @public
* @method configure configure the column from configurator model
*
* @param {ColumnConfig} config the configurator object
*
* @since 0.2
*/
configure(config: ColumnConfig): void;
/**
* @public
* @method fromAlias get aliased column
*
* @param {string} alias the alias label
*
* @return {DbColumn} the aliased column
*
* @since 0.2
*/
fromAlias(alias: string): DbColumn;
}