class Focus::Query

Included Modules

Defined in:

focus/query.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(database : Focus::Database, expression : Focus::SelectExpression) #

[View source]

Instance Method Detail

def aggregate_columns(aggregation : ColumnDeclaring(T)) : T | Nil forall T #

[View source]
def any? : Bool #
Description copied from module Enumerable(Focus::CachedRow)

Returns true if at least one of the collection's members is truthy.

[nil, true, 99].any? # => true
[nil, false].any?    # => false

[View source]
def average_by(selector : BaseColumnDeclaring) : Float32 | Nil #

[View source]
def bind_to(entity : T.class) : Array(T) forall T #

[View source]
def bind_to_first(entity : T.class) : T forall T #

[View source]
def bind_to_first?(entity : T.class) : T | Nil forall T #

[View source]
def bind_to_last(entity : T.class) : T forall T #

[View source]
def bind_to_last?(entity : T.class) : T | Nil forall T #

[View source]
def bind_to_one(entity : T.class, at index : Int32) : T forall T #

[View source]
def bind_to_one?(entity : T.class, at index : Int32) : T | Nil forall T #

[View source]
def count : Int32 #

[View source]
def database : Focus::Database #

[View source]
def drop(n : Int32) : Query #

[View source]
def each(&block : Focus::CachedRow -> Nil) #
Description copied from module Enumerable(Focus::CachedRow)

Must yield this collection's elements to the block.


[View source]
def expression : Focus::SelectExpression #

[View source]
def group_by(columns : Array(BaseColumnDeclaring)) : Query #

[View source]
def group_by(*columns : BaseColumnDeclaring) : Query #

[View source]
def having(condition : ColumnDeclaring(Bool)) : Query #

[View source]
def limit(offset : Int32 | Nil, limit : Int32 | Nil) : Query #

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

[View source]
def max_by(selector : ColumnDeclaring(T)) : T | Nil forall T #

[View source]
def min_by(selector : ColumnDeclaring(T)) : T | Nil forall T #

[View source]
def none? : Bool #
Description copied from module Enumerable(Focus::CachedRow)

Returns true if all of the elements of the collection are falsey.

[nil, false].none?       # => true
[nil, false, true].none? # => false

It's the opposite of all?.


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

[View source]
def order_by(orders : Array(OrderByExpression)) : Query #

[View source]
def order_by(*orders : OrderByExpression) : Query #

[View source]
def result_set : DB::ResultSet #

[View source]
def rows : Array(Focus::CachedRow) #

[View source]
def sum_by(selector : ColumnDeclaring(T)) : T | Nil forall T #

[View source]
def take(n : Int32) : Query #

[View source]
def to_sql : String #

[View source]
def where(condition : Focus::ScalarExpression(Bool)) : Focus::Query #

[View source]
def where_with_conditions(&block : Array(ColumnDeclaring(Bool)) -> Nil) : Focus::Query #

[View source]
def where_with_or_conditions(&block : Array(ColumnDeclaring(Bool)) -> Nil) : Focus::Query #

[View source]