module Modifiable

Overview

Handles query modifiers like ORDER BY, GROUP BY, LIMIT, OFFSET.

Defined in:

query/modifyable.cr

Instance Method Summary

Instance Method Detail

def group(*columns : Symbol | String) #

Specifies the columns to group by.

Example Specifying the columns to group by

query.group(:name, :age)

[View source]
def limit(value : Int32) #

Sets the limit for the number of records to return.

Example Setting the limit for the number of records to return

query.limit(10)

[View source]
def offset(value : Int32) #

Sets the offset for the query.

Example Setting the offset for the query

query.offset(10)

[View source]
def order(*fields : Symbol | String) #

Specifies the columns to order by (ASC implicitly).

Example Specifying the columns to order by

query.order(:name, :age)

[View source]
def order(**fields) #

Specifies the columns to order by with direction.

Example Specifying the columns to order by with direction

query.order(name: :asc, age: :desc)

[View source]