import { AnyExpression, Condition, Expression, ToType } from '../expressions'; import { ArrayType, BooleanArg, BooleanType, ByteaArg, CharacterArg, IntervalArg, JSONType, JSONBType, BigintArg, BigintType, DoubleArg, DoubleType, IntegerArg, IntegerType, MathLiteral, NumericArg, NumericType, RealArg, RealType, SmallintArg, SmallintType, BitArg, BitType, TextType, ByteaType, IntervalType } from '../types'; export interface AggregateConfig { distinct?: boolean; orderBy?: (AnyExpression | { by: AnyExpression; direction?: 'ASC' | 'DESC'; using?: string; nulls?: 'FIRST' | 'LAST'; })[]; withinGroup?: (AnyExpression | { by: AnyExpression; direction?: 'ASC' | 'DESC'; nulls?: 'FIRST' | 'LAST'; })[]; filterWhere?: Condition; } export declare const stringifyAggregateConfig: (args: any[], config?: AggregateConfig | undefined) => import("..").Template; /** * @description Collects all the input values, including nulls, into an array. * * @signature array_agg ( any ) → anyarray */ export declare function ARRAY_AGG(el: T, aggregateConfig?: AggregateConfig): Expression>>; /** * @description Computes the average (arithmetic mean) of all the non-null input values. * * @signature avg ( smallint ) → numeric */ export declare function AVG(arg: NumericArg, aggregateConfig?: AggregateConfig): Expression; export declare function AVG(arg: DoubleArg, aggregateConfig?: AggregateConfig): Expression; export declare function AVG(arg: IntervalArg, aggregateConfig?: AggregateConfig): Expression; /** * @description Computes the bitwise AND of all non-null input values. * * @signature bit_and ( smallint ) → smallint */ export declare function BIT_AND(arg: SmallintArg, aggregateConfig?: AggregateConfig): Expression; export declare function BIT_AND(arg: IntegerArg, aggregateConfig?: AggregateConfig): Expression; export declare function BIT_AND(arg: BigintArg, aggregateConfig?: AggregateConfig): Expression; export declare function BIT_AND(arg: BitArg, aggregateConfig?: AggregateConfig): Expression; /** * @description Computes the bitwise OR of all non-null input values. * * @signature bit_or ( smallint ) → smallint */ export declare function BIT_OR(arg: SmallintArg, aggregateConfig?: AggregateConfig): Expression; export declare function BIT_OR(arg: IntegerArg, aggregateConfig?: AggregateConfig): Expression; export declare function BIT_OR(arg: BigintArg, aggregateConfig?: AggregateConfig): Expression; export declare function BIT_OR(arg: BitArg, aggregateConfig?: AggregateConfig): Expression; /** * @description Returns true if all non-null input values are true, otherwise false. * * @signature bool_and ( boolean ) → boolean */ export declare function BOOL_AND(arg: BooleanArg, aggregateConfig?: AggregateConfig): Expression; /** * @description Returns true if any non-null input value is true, otherwise false. * * @signature bool_or ( boolean ) → boolean */ export declare function BOOL_OR(arg: BooleanArg, aggregateConfig?: AggregateConfig): Expression; /** * @description Computes the number of input rows. * * @signature count ( * ) → bigint */ export declare function COUNT(arg: AnyExpression | '*', aggregateConfig?: AggregateConfig): Expression; /** * @description This is the SQL standard's equivalent to bool_and. * * @signature every ( boolean ) → boolean */ export declare function EVERY(arg: BooleanArg, aggregateConfig?: AggregateConfig): Expression; /** * @description Collects all the input values, including nulls, into a JSON array. Values * are converted to JSON as per to_json or to_jsonb. * * @signature json_agg ( anyelement ) → json */ export declare function JSON_AGG(arg: any, aggregateConfig?: AggregateConfig): Expression; /** * @description Collects all the input values, including nulls, into a JSON array. Values * are converted to JSON as per to_json or to_jsonb. * * @signature jsonb_agg ( anyelement ) → jsonb */ export declare function JSONB_AGG(arg: any, aggregateConfig?: AggregateConfig): Expression; /** * @description Collects all the key/value pairs into a JSON object. Key arguments are * coerced to text; value arguments are converted as per to_json or to_jsonb. * Values can be null, but not keys. * * @signature json_object_agg ( key "any", value "any" ) → json */ export declare function JSON_OBJECT_AGG(key: any, value: any, aggregateConfig?: AggregateConfig): Expression; /** * @description Collects all the key/value pairs into a JSON object. Key arguments are * coerced to text; value arguments are converted as per to_json or to_jsonb. * Values can be null, but not keys. * * @signature jsonb_object_agg ( key "any", value "any" ) → jsonb */ export declare function JSONB_OBJECT_AGG(key: any, value: any, aggregateConfig?: AggregateConfig): Expression; /** * @description Computes the maximum of the non-null input values. Available for any numeric, * string, date/time, or enum type, as well as inet, interval, money, oid, * pg_lsn, tid, and arrays of any of these types. * * @signature max ( see text ) → same as input type */ export declare function MAX(arg: T, aggregateConfig?: AggregateConfig): Expression>; /** * @description Computes the minimum of the non-null input values. Available for any numeric, * string, date/time, or enum type, as well as inet, interval, money, oid, * pg_lsn, tid, and arrays of any of these types. * * @signature min ( see text ) → same as input type */ export declare function MIN(arg: T, aggregateConfig?: AggregateConfig): Expression>; /** * @description Concatenates the non-null input values into a string. Each value after the * first is preceded by the corresponding delimiter (if it's not null). * * @signature string_agg ( value text, delimiter text ) → text */ export declare function STRING_AGG(value: CharacterArg, delimiter: CharacterArg, aggregateConfig?: AggregateConfig): Expression; export declare function STRING_AGG(value: ByteaArg, delimiter: ByteaArg, aggregateConfig?: AggregateConfig): Expression; /** * @description Computes the sum of the non-null input values. * @signature sum ( smallint ) → bigint */ export declare function SUM(arg: MathLiteral, aggregateConfig?: AggregateConfig): Expression; export declare function SUM(arg: IntegerArg, aggregateConfig?: AggregateConfig): Expression; export declare function SUM(arg: NumericArg, aggregateConfig?: AggregateConfig): Expression; export declare function SUM(arg: RealArg, aggregateConfig?: AggregateConfig): Expression; export declare function SUM(arg: DoubleArg, aggregateConfig?: AggregateConfig): Expression; export declare function SUM(arg: IntervalArg, aggregateConfig?: AggregateConfig): Expression;