import { Query } from './Query'; import { StringExpression } from './StringExpression'; import { EntityQuery } from './EntityQuery'; export declare enum Operators { '=' = "=", '<' = "<", '<=' = "<=", '>' = ">", '>=' = ">=", '!=' = "!=", 'AND' = "AND", 'OR' = "OR", 'IS' = "IS", 'IN' = "IN", 'NOT IN' = "NOT IN", 'LIKE' = "LIKE", 'IS NOT' = "IS NOT" } export declare enum JoinType { INNER = "INNER", LEFT = "LEFT", RIGHT = "RIGHT" } export type BooleanOperator = 'AND' | 'OR' | 'XOR'; export type Operator = keyof typeof Operators; export type SqlValue = string | number | Date | undefined; export type SqlValueMap = { [key: string]: SqlValue; }; declare class JoinClause { type: keyof typeof JoinType; table: string; first: string; operator: Operator; second: string; } export interface BaseComponents { table: string; } export interface CreateComponents { table: string; columns: (string | StringExpression)[]; } export interface SelectComponents extends BaseComponents { distinct?: boolean; columns: (string | StringExpression)[]; aggregate?: { function: string; columns: string[]; }; joins: JoinClause[]; wheres: SqlClause[]; groups: string[]; orders: [string, Direction][]; having: Where[]; limit?: { from: number; count?: number; }; } export interface InsertComponents extends BaseComponents { insert?: SqlValueMap[]; } export interface UpdateComponents extends BaseComponents { update?: SqlValueMap; } export interface Components extends BaseComponents, SelectComponents, InsertComponents, UpdateComponents, CreateComponents { } export type WhereFunction = (query: Query) => void; export type WhereCondition = { [key: string]: string | number; }; export type WhereValue = SqlValue; export type Direction = 'ASC' | 'DESC'; export interface SqlClause { toSql(): string; getValues(): SqlValue[]; } declare class SqlExpression implements SqlClause { private sql; private values; constructor(sql: string, values?: SqlValue[]); toSql(): string; getValues(): SqlValue[]; } export declare class WhereExpression extends SqlExpression { column: string; expression: SqlExpression; boolean: BooleanOperator; constructor(column: string, expression: SqlExpression, boolean: BooleanOperator); } export declare class Where extends WhereExpression { constructor(column: string, operator: Operator, value: SqlValue, boolean: BooleanOperator); } export declare class WhereNested { } export declare class WhereBetween extends WhereExpression { constructor(column: string, values: [SqlValue, SqlValue], boolean: BooleanOperator, not?: boolean); } export declare class WhereLike extends WhereExpression { constructor(column: string, value: SqlValue, boolean: BooleanOperator, not?: boolean); } export declare class WhereIn extends WhereExpression { constructor(column: string, values: WhereValue[], boolean: BooleanOperator, not?: boolean); } export declare class WhereNull extends WhereExpression { constructor(column: string, boolean: BooleanOperator, not?: boolean); } export declare class WhereSubSelect extends WhereExpression { query: Query; constructor(column: string, operator: Operator, query: Query, boolean: BooleanOperator); } export type RelationsTreeQuery = (query: EntityQuery) => void; export interface RelationsTree { [key: string]: RelationsTree | RelationsTreeQuery; } export {}; //# sourceMappingURL=Types.d.ts.map