class
Avram::QueryBuilder
- Avram::QueryBuilder
- Reference
- Object
Defined in:
avram/query_builder.crConstructors
Instance Method Summary
- #args : Array(String | Array(String) | Array(Int32))
- #args_for_update(params)
-
#clear_conjunction
Clears the last conjunction e.g.
-
#clone
Returns a copy of
selfwith all instance variables cloned. -
#conditions_for_join : Array(Avram::Where::Condition)
ON accepts the query's WHERE predicates, not a subquery with its own clauses.
- #delete : self
- #distinct : self
- #distinct? : Bool
- #distinct_on(column : ColumnName) : self
- #distinct_on : ColumnName | Nil
- #for_update : self
- #group_by(column : ColumnName) : self
- #group_sql : String | Nil
- #grouped? : Bool
- #groups : Array(ColumnName)
- #has_distinct_on? : Bool
- #join(join_clause : Avram::Join::SqlClause) : self
- #joins : Array(Avram::Join::SqlClause)
- #limit(limit : Int32 | Nil) : self
- #limit : Int32 | Nil
-
#merge(query_to_merge : Avram::QueryBuilder)
Merges the wheres, joins, and orders from the passed in query
- #offset(offset : Int32 | Nil) : self
- #offset : Int32 | Nil
- #or(&block : Avram::QueryBuilder -> Avram::QueryBuilder) : self
- #order_by(order : OrderByClause) : self
- #order_sql : String | Nil
- #ordered? : Bool
- #ordered_randomly? : Bool
- #orders : Array(Avram::OrderByClause)
- #random_order : self
-
#remove_last_where
Removes the last
Avram::Whereto be added - #reset_order : Array(Avram::OrderByClause)
- #reset_where(column : ColumnName) : self
- #reverse_order : self
- #select(selection : Array(ColumnName)) : self
- #select(selections : String) : self
- #select_average(column : ColumnName) : self
- #select_count : self
- #select_direct(selection : Array(ColumnName)) : self
- #select_max(column : ColumnName) : self
- #select_min(column : ColumnName) : self
- #select_sum(column : ColumnName) : self
- #selects : Array(String)
- #statement : String
- #statement! : String
- #statement_for_update(params, return_columns returning : Bool = true)
-
#statement_for_update!(params, return_columns returning : Bool = true)
Creates the SQL for updating.
- #table : TableName
-
#to_prepared_sql : String
Prepares the SQL statement by combining the
#argsand#statementin to a singleString -
#to_prepared_where_sql : String
Bare WHERE predicate (no "WHERE " prefix), values inlined as literals since DDL index predicates can't use bind params.
- #to_sql : Array(Array(Int32) | Array(String) | String)
- #where(where_clause : Avram::Where::Condition) : self
- #wheres : Array(Avram::Where::Condition)
Instance methods inherited from class Object
blank_for_validates_required? : Bool
blank_for_validates_required?
Constructor Detail
Instance Method Detail
ON accepts the query's WHERE predicates, not a subquery with its own clauses.
Merges the wheres, joins, and orders from the passed in query
Creates the SQL for updating. If any joins are present, it moves the WHERE clause to a subquery allowing for joins
Prepares the SQL statement by combining the #args and #statement
in to a single String
Bare WHERE predicate (no "WHERE " prefix), values inlined as literals since DDL index predicates can't use bind params. Raises if there are no conditions.