module Executable
Overview
Handles query execution methods.
Defined in:
query/executable.crInstance Method Summary
-
#all(as as_kind)
Executes the query and returns all records.
-
#all!(as as_kind)
Executes the query and returns all records, raising an error if nil.
-
#each(as as_kind, &)
Iterates over each result and yields it to the provided block.
-
#first(as as_kind)
Executes the query and returns the first record.
-
#first!(as as_kind)
Executes the query and returns the first record, raising an error if nil.
-
#get(as as_kind)
Executes the query and returns a scalar value.
Instance Method Detail
Executes the query and returns all records.
Example Executing the query and returning all records
query.all(User)
=> [{"name" => "John", "age" => 30}]
Executes the query and returns all records, raising an error if nil.
Example Executing the query and returning all records, raising an error if nil
query.all!(User)
=> [{"name" => "John", "age" => 30}]
Iterates over each result and yields it to the provided block.
Example Iterating over each result and yielding it to the provided block
query.each(User) do |user|
puts user.name
end
Executes the query and returns the first record.
Example Executing the query and returning the first record
query.first(User)
=> {"name" => "John", "age" => 30}
Executes the query and returns the first record, raising an error if nil.
Example Executing the query and returning the first record, raising an error if nil
query.first!(User)
=> {"name" => "John", "age" => 30}
Executes the query and returns a scalar value.
Example Executing the query and returning a scalar value
query.get(Int32)
=> 100