pg-query-config
Version:
Query Builder for PostgreSQL
35 lines (34 loc) • 1.15 kB
TypeScript
import { QueryParams, WhereCondition, OrderCondition } from './types';
export declare class QueryConfig<T extends {
[key in string]: any;
}> {
sqlCommand: string;
private readonly schema?;
private readonly table;
private columnSet;
private joinSet;
private whereSet;
private orderSet;
private limit?;
private offset?;
private valueRefSet;
constructor({ schema, table, columns, limit, offset }: QueryParams<T>);
select(column: keyof T | Array<keyof T>): this;
join(table: string, condition: string): this;
leftJoin(table: string, condition: string): this;
rightJoin(table: string, condition: string): this;
where(whereCondition: WhereCondition<T>): this;
orWhere(whereConditions: WhereCondition<T>[]): this;
order(orderCondition: OrderCondition<T>): this;
private buildWhereConditions;
get text(): string;
get values(): any[];
private buildOrderConditions;
private get sqlColumns();
private get sqlFrom();
private get sqlJoin();
private get sqlWhere();
private get sqlOrder();
private get sqlLimit();
private get sqlOffset();
}