UNPKG

tspace-sql

Version:

mysql & postgresql query builder object relational mapping

195 lines (194 loc) 5.02 kB
import AbstractModel from './AbstractModel'; import { Relation } from './Interface'; declare class Model extends AbstractModel { constructor(); useRegistry(): this; useUUID(custom?: string): this; useDebug(): this; useDefaultScope(defalutScope: object): this; useResultSnakeCase(): this; useResultCamelCase(): this; usePattern(pattern: string): this; useDefaultOrderBy(column: string, { latest }?: { latest?: boolean | undefined; }): this; useSoftDelete(): this; useTimestamp(): this; useTable: (table: string) => this; transaction(transaction?: {}): this; disabledSoftDelete(): this; registry(func: any): this; except(...params: Array<string>): this; only(...params: Array<string>): this; callback(cb: Function): any; with(...nameRelations: Array<any>): this; withExists(...nameRelations: Array<any>): this; withHas(...nameSubRelations: Array<string>): this; withChild(...nameSubRelations: Array<string>): this; whereHas(nameRelation: string, obj: { where?: any; whereIn?: any; whereNull?: any; }): this; hasOne({ name, as, model, pk, fk, select, hidden, freezeTable, child }: Relation): void; hasMany({ name, as, model, pk, fk, select, hidden, freezeTable, child }: Relation): void; belongsTo({ name, as, model, pk, fk, select, hidden, freezeTable, child }: Relation): void; belongsToMany({ name, as, model, pk, fk, select, hidden, freezeTable, child }: Relation): void; trashed({ debug }?: { debug?: boolean | undefined; }): Promise<any>; onlyTrashed({ debug }?: { debug?: boolean | undefined; }): Promise<any>; restore({ debug }?: { debug?: boolean | undefined; }): Promise<any>; /** * * @Override Method * */ toString({ debug }?: { debug?: boolean | undefined; }): string; /** * * @Override Method * */ toSQL({ debug }?: { debug?: boolean | undefined; }): string; /** * * @Override Method * */ toJSON({ debug }?: { debug?: boolean | undefined; }): Promise<string | never[]>; /** * * @Override Method * */ toArray(column?: string, { debug }?: { debug?: boolean | undefined; }): Promise<any[]>; /** * * @Override Method * */ avg(column?: string, { debug }?: { debug?: boolean | undefined; }): Promise<any>; /** * * @Override Method * */ sum(column?: string, { debug }?: { debug?: boolean | undefined; }): Promise<any>; /** * * @Override Method * */ max(column?: string, { debug }?: { debug?: boolean | undefined; }): Promise<any>; /** * * @Override Method * */ min(column?: string, { debug }?: { debug?: boolean | undefined; }): Promise<any>; /** * * @Override Method * */ count(column?: string, { debug }?: { debug?: boolean | undefined; }): Promise<any>; /** * * @Override Method * */ delete({ debug }?: { debug?: boolean | undefined; }): Promise<boolean>; /** * * @Override Method * */ first({ debug }?: { debug?: boolean | undefined; }): Promise<any>; findOne({ debug }?: { debug?: boolean | undefined; }): Promise<any>; /** * * @Override Method * */ get({ debug }?: { debug?: boolean | undefined; }): Promise<any>; findMany({ debug }?: { debug?: boolean | undefined; }): Promise<any>; /** * * @Override Method * */ pagination({ debug, limit, page }?: { debug?: boolean | undefined; limit?: number | undefined; page?: number | undefined; }): Promise<any>; /** * * @Override Method * */ getByGroup(column: string, { debug }?: { debug?: boolean | undefined; }): Promise<any>; private _isPatternSnakeCase; private _classToTableName; private _tableName; private _valueInRelationChild; private _valueInRelation; private _defaultScope; resetQuery(): void; private _getSQLModel; private _exceptColumns; private _showOnly; private _exec; private _execGroup; private _relationFilterChild; private _relationFilter; private _relation; private _relationChild; private _relationChildBelongsToMany; private _belongsToMany; private _pagination; private _resultPattern; private _snakeCase; private _camelCase; private _returnEmpty; private _returnResult; private _hiddenColumnModel; private _attach; private _detach; } export default Model;