tspace-sql
Version:
mysql & postgresql query builder object relational mapping
139 lines (138 loc) • 5.14 kB
TypeScript
import Abstract from './AbstractBase';
declare class Base extends Abstract {
pluck(column: string): this;
select(...params: string[]): this;
whereNull(column: string): this;
whereNotNull(column: string): this;
whereSensitive(column: string, operator?: any, value?: any): this;
whereGroupStart(column: string, operator?: any, value?: any): this;
orWhereGroupStart(column: string, operator?: any, value?: any): this;
whereGroupEnd(column: string, operator?: any, value?: any): this;
orWhereGroupEnd(column: string, operator?: any, value?: any): this;
where(column: string, operator?: any, value?: any): this;
whereId(id: number): this;
whereEmail(value: any): this;
whereUser(id: number): this;
orWhere(column: string, operator?: any, value?: any): this;
orWhereIn(column: string, arrayValues: Array<any>): this;
whereIn(column: string, arrayValues: Array<any>): this;
whereNotIn(column: string, arrayValues: Array<any>): this;
whereSubQuery(column: string, subQuery: string): this;
whereNotInSubQuery(column: string, subQuery: string): this;
orWhereSubQuery(column: string, subQuery: string): this;
whereBetween(column: string, arrayValue: Array<any>): this;
having(condition: string): this;
join(pk: string, fk: string): this;
rightJoin(pk: string, fk: string): this;
leftJoin(pk: string, fk: string): this;
orderBy(column: string, order?: any): this;
latest(column?: string): this;
oldest(column?: string): this;
groupBy(column: string): this;
limit(number?: number): this;
hidden(...columns: any): this;
update(objects: object): this;
insert(objects: object): this;
create(objects: object, transaction?: {}): this;
createMultiple(data: Array<any>, transaction?: {}): this;
toString({ debug }?: {
debug?: boolean | undefined;
}): string;
toSQL({ debug }?: {
debug?: boolean | undefined;
}): string;
debug(): this;
queryStatement(sql: string): Promise<any>;
actionStatement({ sql, returnId }?: {
sql?: string;
returnId?: boolean;
}): Promise<any>;
all({ debug }?: {
debug?: boolean | undefined;
}): Promise<any>;
find(id: number, { debug }?: {
debug?: boolean | undefined;
}): Promise<any>;
pagination({ limit, page, debug }?: {
limit?: number | undefined;
page?: number | undefined;
debug?: boolean | undefined;
}): Promise<{
currentPage: number;
lastPage: number;
total: number;
limit: number;
result: any[];
} | (number | never[])[]>;
findOne({ debug }?: {
debug?: boolean | undefined;
}): Promise<any>;
first({ debug }?: {
debug?: boolean | undefined;
}): Promise<any>;
findMany({ debug }?: {
debug?: boolean | undefined;
}): Promise<any[]>;
get({ debug }?: {
debug?: boolean | undefined;
}): Promise<any[]>;
toJSON({ debug }?: {
debug?: boolean | undefined;
}): Promise<string | never[]>;
toArray(column?: string, { debug }?: {
debug?: boolean | undefined;
}): Promise<any[]>;
count(column?: string, { debug }?: {
debug?: boolean | undefined;
}): Promise<any>;
exists({ debug }?: {
debug?: boolean | undefined;
}): Promise<boolean>;
avg(column?: string, { debug }?: {
debug?: boolean | undefined;
}): Promise<any>;
sum(column?: string, { debug }?: {
debug?: boolean | undefined;
}): Promise<any>;
max(column?: string, { debug }?: {
debug?: boolean | undefined;
}): Promise<any>;
min(column?: string, { debug }?: {
debug?: boolean | undefined;
}): Promise<any>;
delete({ debug }?: {
debug?: boolean | undefined;
}): Promise<boolean>;
getByGroup(column: string, { debug }?: {
debug?: boolean | undefined;
}): Promise<any>;
findManyByGroup(column: string, { debug }?: {
debug?: boolean | undefined;
}): Promise<any>;
createNotExists(objects: object, transaction?: {}): this;
insertNotExists(objects: object, transaction?: {}): this;
upsert(objects: object, transaction?: {}): this;
insertOrUpdate(objects: object, transaction?: {}): this;
createOrUpdate(objects: object, transaction?: {}): this;
updateOrInsert(objects: object, transaction?: {}): this;
updateOrCreate(objects: object, transaction?: {}): this;
save({ debug }?: {
debug?: boolean | undefined;
}): Promise<any>;
private _insertNotExists;
private _create;
private _createMultiple;
private _updateOrInsert;
private _update;
private _hiddenColumn;
private _isSnakeCase;
private _queryUpdate;
private _queryInsert;
private _queryInsertMultiple;
private _valueAndOperator;
private _valueTrueFalse;
private _getSQL;
private _covertBooleanToNumber;
private _registry;
}
export default Base;