module Aggregatable

Overview

Handles aggregate functions.

Defined in:

query/aggregatable.cr

Instance Method Summary

Instance Method Detail

def avg(column : Symbol) #

Adds an AVG aggregate function to the query.

Example Calculating the average value

query.avg(:age)
=> 100

[View source]
def count(column : Symbol = :*) #

Adds a COUNT aggregate function to the query.

Example Counting all rows

query.count
=> 100

[View source]
def max(column : Symbol) #

Adds a MAX aggregate function to the query.

Example Finding the maximum value

query.max(:age)
=> 100

[View source]
def min(column : Symbol) #

Adds a MIN aggregate function to the query.

Example Finding the minimum value

query.min(:age)
=> 100

[View source]
def sum(column : Symbol) #

Adds a SUM aggregate function to the query.

Example Summing all values

query.sum(:age)
=> 100

[View source]