import { AnyExpression, Condition, Expression, UnknownLiteral } from '../../expressions'; import { QueryDefinition, Source } from '../../source'; import { Template } from '../../template'; import { MathArg } from '../../types'; import { FieldsConfig } from '../common/fields'; import { FromConfig } from '../common/from'; import { WithConfig } from '../common/with'; declare type U2I = (U extends any ? (k: U) => any : never) extends ((k: infer I) => any) ? I : never; declare type ArrayToUnion = T extends Array ? I : T; declare type Normalize = U2I<{ [K in keyof R]: R[K] extends Record ? R[K] : { [P in K]: R[P] extends Expression ? R[P] : Expression>; }; }[keyof R]>; export declare type MapToExpression> = { [K in keyof Normalize]: Normalize[K]; }; declare type IfExists = undefined extends O ? E : T; declare type InferFromType = ArrayToUnion extends (Source | { source: Source; }) ? R : never; export declare function SELECT(config: T): QueryDefinition<{ [K in keyof U2I>, InferFromType>>]: U2I>, InferFromType>>[K] extends AnyExpression, boolean, any>> ? U2I>, InferFromType>>[K] : never; }>; export interface SelectConfig { with?: WithConfig; distinct?: boolean | AnyExpression[]; fields?: FieldsConfig; from?: FromConfig; where?: Condition; groupBy?: (AnyExpression | AnyExpression[])[]; having?: Condition; orderBy?: (AnyExpression | { by: AnyExpression; direction?: 'ASC' | 'DESC'; using?: string; nulls?: 'FIRST' | 'LAST'; })[]; limit?: MathArg | 'ALL'; offset?: MathArg | { start: MathArg; plurality?: 'ROW' | 'ROWS'; }; fetch?: MathArg | { start?: 'FIRST' | 'NEXT'; count: MathArg; plurality?: 'ROW' | 'ROWS'; withTies?: boolean; }; for?: ('UPDATE' | 'NO KEY UPDATE' | 'SHARE' | 'KEY SHARE' | { strength: 'UPDATE' | 'NO KEY UPDATE' | 'SHARE' | 'KEY SHARE'; of?: Source[]; waiting?: 'NOWAIT' | 'SKIP LOCKED'; })[]; } export declare const stringifySelect: (config: SelectConfig) => Template; export declare const stringifyGroupedExpression: (config: (AnyExpression | AnyExpression[])) => Template; export declare const stringifyOrderBy: (config: Exclude[number]) => Template; export declare const stringifyOffset: (config: MathArg | { start: MathArg; plurality?: 'ROW' | 'ROWS'; }) => Template; export declare const stringifyFetch: (config: Exclude) => Template; export declare const stringifyFor: (config: Exclude[number]) => Template; export declare const stringifyDistinct: (config: boolean | AnyExpression[]) => Template; export {};