class Avram::QueryBuilder

Defined in:

avram/query_builder.cr

Constructors

Instance Method Summary

Instance methods inherited from class Object

blank_for_validates_required? : Bool blank_for_validates_required?

Constructor Detail

def self.new(table : String | Symbol) #

[View source]

Instance Method Detail

def args : Array(String | Array(String) | Array(Int32)) #

[View source]
def args_for_update(params) #

[View source]
def clear_conjunction #

Clears the last conjunction e.g. users.age = $1 AND -> users.age = $1


[View source]
def clone #

Returns a copy of self with all instance variables cloned.


[View source]
def delete : self #

[View source]
def distinct : self #

[View source]
def distinct? : Bool #

[View source]
def distinct_on(column : ColumnName) : self #

[View source]
def distinct_on : ColumnName | Nil #

[View source]
def group_by(column : ColumnName) : self #

[View source]
def group_sql : String | Nil #

[View source]
def grouped? : Bool #

[View source]
def groups : Array(ColumnName) #

[View source]
def has_distinct_on? : Bool #

[View source]
def join(join_clause : Avram::Join::SqlClause) : self #

[View source]

[View source]
def limit(limit : Int32 | Nil) : self #

[View source]
def limit : Int32 | Nil #

[View source]
def merge(query_to_merge : Avram::QueryBuilder) #

Merges the wheres, joins, and orders from the passed in query


[View source]
def offset(offset : Int32 | Nil) : self #

[View source]
def offset : Int32 | Nil #

[View source]
def or(&block : Avram::QueryBuilder -> Avram::QueryBuilder) : self #

[View source]
def order_by(order : OrderByClause) : self #

[View source]
def order_sql : String | Nil #

[View source]
def ordered? : Bool #

[View source]
def ordered_randomly? : Bool #

[View source]
def orders : Array(Avram::OrderByClause) #

[View source]
def random_order : self #

[View source]
def remove_last_where #

Removes the last Avram::Where to be added


[View source]
def reset_order : Array(Avram::OrderByClause) #

[View source]
def reset_where(column : ColumnName) : self #

[View source]
def reverse_order : self #

[View source]
def select(selection : Array(ColumnName)) : self #

[View source]
def select(selections : String) : self #

[View source]
def select_average(column : ColumnName) : self #

[View source]
def select_count : self #

[View source]
def select_direct(selection : Array(ColumnName)) : self #

[View source]
def select_max(column : ColumnName) : self #

[View source]
def select_min(column : ColumnName) : self #

[View source]
def select_sum(column : ColumnName) : self #

[View source]
def selects : Array(String) #

[View source]
def statement : String #

[View source]
def statement! : String #

[View source]
def statement_for_update(params, return_columns returning? : Bool = true) #

[View source]
def statement_for_update!(params, return_columns returning? : Bool = true) #

Creates the SQL for updating. If any joins are present, it moves the WHERE clause to a subquery allowing for joins


[View source]
def table : TableName #

[View source]
def to_prepared_sql : String #

Prepares the SQL statement by combining the #args and #statement in to a single String


[View source]
def to_sql : Array(Array(Int32) | Array(String) | String) #

[View source]
def where(where_clause : Avram::Where::Condition) : self #

[View source]

[View source]