class

Granite::Query::Builder(Model)

Inherits Reference < Object

Data structure which will allow chaining of query components, nesting of boolean logic, etc.

Should return self, or another instance of Builder wherever chaining should be possible.

Current query syntax:

  • where(field: value) => "WHERE field = 'value'"

Hopefully soon:

  • Model.where(field: value).not( Model.where(field2: value2) ) or

  • Model.where(field: value).not { where(field2: value2) }

  • Model.where(field: value).or( Model.where(field3: value3) ) or

  • Model.where(field: value).or { whehre(field3: value3) }

Constructors

new(db_type : Granite::Query::Builder::DbType, boolean_operator : Symbol = :and)
Source

Instance methods

and(field : Symbol | String, operator : Symbol, value : Granite::Columns::Type)
Source
and(stmt : String, value : Granite::Columns::Type = nil)
Source
and(matches)
Source
any?
Source
assembler
Source
count
Source
db_type
Source
delete
Source
each
Source
exists?
Source
group_by(field : Symbol)
Source
group_by(fields : Array(Symbol))
Source
group_by(dsl)
Source
group_by
Source
group_fields
Source
limit(num)
Source
limit
Source
offset(num)
Source
offset
Source
or(field : Symbol | String, operator : Symbol, value : Granite::Columns::Type)
Source
or(stmt : String, value : Granite::Columns::Type = nil)
Source
or(matches)
Source
order(field : Symbol)
Source
order(fields : Array(Symbol))
Source
order(dsl)
Source
order
Source
order_fields
Source
raw_sql
Source
reject
Source
select
Source
size
Source
where(field : Symbol | String, operator : Symbol, value : Granite::Columns::Type)
Source
where(stmt : String, value : Granite::Columns::Type = nil)
Source
where(matches)
Source
where
Source
where_fields
Source

Nested types