tspace-sql
Version:
mysql & postgresql query builder object relational mapping
40 lines (39 loc) • 1.87 kB
TypeScript
import Base from './Base';
import { Relation, RelationShip, RelationShipChild } from './Interface';
declare abstract class AbstractModel extends Base {
protected SOFT_DELETE: boolean;
protected RELATION: Array<any>;
protected RELATION_CHILD: Array<any>;
protected DEFAULT_ORDER_BY: string | undefined;
protected DEFAULT_SCOPE: object;
protected WITH: any;
protected WITH_EXISTS: boolean;
protected RELATIONSHIP: RelationShip;
protected RELATIONSHIP_CHILD: RelationShipChild;
protected PAGE: number;
protected PERPAGE: number;
protected RESULT_PATTERN: string;
abstract useDebug(): void;
abstract useTable(table: string): void;
abstract useTimestamp(): void;
abstract useSoftDelete(): void;
abstract useDefaultOrderBy(column: string, { latest }: {
latest: boolean;
}): void;
abstract useDefaultScope(defalutScope: object): void;
abstract usePattern(pattern: string): void;
abstract onlyTrashed(): void;
abstract trashed(): void;
abstract restore(): void;
abstract except(...params: string[]): void;
abstract with(...nameRelations: string[]): void;
abstract withExists(...nameRelations: string[]): void;
abstract withHas(...nameSubRelations: string[]): void;
abstract withChild(...nameSubRelations: string[]): void;
abstract whereHas(nameRelation: string, obj: object): void;
abstract hasOne({ name, model, pk, fk, select, hidden, freezeTable, child }: Relation): void;
abstract hasMany({ name, model, pk, fk, select, hidden, freezeTable, child }: Relation): void;
abstract belongsTo({ name, model, pk, fk, select, hidden, freezeTable, child }: Relation): void;
abstract belongsToMany({ name, model, pk, fk, select, hidden, freezeTable, child }: Relation): void;
}
export default AbstractModel;