Libraries v5.0.0
    Preparing search index...

    Variable aggregateConst

    aggregate: {
        avg<S extends OutputSchema<any> | undefined = undefined>(
            column: SelectableColumn,
            options?: AggregateOptions<S>,
        ): AggregateExpression<AggregateResult<S, string | null>>;
        count<S extends OutputSchema<any> | undefined = undefined>(
            column?: SelectableColumn,
            options?: AggregateOptions<S>,
        ): AggregateExpression<AggregateResult<S, number>>;
        countDistinct<S extends OutputSchema<any> | undefined = undefined>(
            column: SelectableColumn,
            options?: AggregateOptions<S>,
        ): AggregateExpression<AggregateResult<S, number>>;
        max<
            C extends SelectableColumn,
            S extends OutputSchema<any> | undefined = undefined,
        >(
            column: C,
            options?: AggregateOptions<S>,
        ): AggregateExpression<AggregateResult<S, ExtremumValue<C>>>;
        min<
            C extends SelectableColumn,
            S extends OutputSchema<any> | undefined = undefined,
        >(
            column: C,
            options?: AggregateOptions<S>,
        ): AggregateExpression<AggregateResult<S, ExtremumValue<C>>>;
        sum<S extends OutputSchema<any> | undefined = undefined>(
            column: SelectableColumn,
            options?: AggregateOptions<S>,
        ): AggregateExpression<AggregateResult<S, string | null>>;
    }

    Typed aggregate expressions for scalar or grouped object projections.

    Type Declaration

    • avg: function
      • Describe AVG(column), preserving database numeric text or null by default. An output parser can explicitly convert it to a number or domain decimal type. Text output cannot recover precision already lost in floating-point storage.

        Type Parameters

        Parameters

        Returns AggregateExpression<AggregateResult<S, string | null>>

    • count: function
      • Describe COUNT(*) or COUNT(column) for a typed projection or HAVING clause.

        Type Parameters

        Parameters

        • Optionalcolumn: SelectableColumn

          Omit to count rows; supply a column to count its non-null values.

        • Optionaloptions: AggregateOptions<S>

          Optional raw-value parser; use undefined as column for custom COUNT(*).

        Returns AggregateExpression<AggregateResult<S, number>>

        An expression decoded as a safe number unless a parser is supplied.

        During execution if the default result exceeds the safe integer range.

    • countDistinct: function
    • max: function
      • Describe MAX(column), returning the column representation or null. Numeric/decimal/bigint SQL overrides preserve exact strings; dates return Date. An optional output parser replaces this decoding policy.

        Type Parameters

        • C extends SelectableColumn
        • S extends OutputSchema<any> | undefined = undefined

        Parameters

        Returns AggregateExpression<AggregateResult<S, ExtremumValue<C>>>

    • min: function
      • Describe MIN(column), returning the column representation or null. Numeric/decimal/bigint SQL overrides preserve exact strings; dates return Date. An optional output parser replaces this decoding policy.

        Type Parameters

        • C extends SelectableColumn
        • S extends OutputSchema<any> | undefined = undefined

        Parameters

        Returns AggregateExpression<AggregateResult<S, ExtremumValue<C>>>

    • sum: function
      • Describe SUM(column) with exact database numeric text as the default result. Empty/all-null inputs produce null. An output parser receives the raw driver value and takes responsibility for precision and null handling.

        Type Parameters

        Parameters

        Returns AggregateExpression<AggregateResult<S, string | null>>