module Sandstone::ORM::Querying
Defined in:
sandstone/querying.crInstance Method Summary
-
#all(clause = "", params = [] of DB::Any)
All will return all rows in the database.
-
#clear
Clear is used to remove all rows from the table and reset the counter for the primary key.
- #exec(clause = "")
-
#find(value)
find returns the row with the primary key specified.
-
#find_by(field : Symbol, value)
find_by using symbol for field name.
-
#find_by(field : String, value)
find_by returns the first row found where the field maches the value
- #find_collection(values)
- #find_collection_by(field : Symbol, values)
- #find_collection_by(field : String, values)
- #find_each(clause = "", params = [] of DB::Any, batch_size limit = 100, offset = 0, &)
- #find_in_batches(clause = "", params = [] of DB::Any, batch_size limit = 100, offset = 0, &)
-
#first(clause = "", params = [] of DB::Any)
First adds a
LIMIT 1
clause to the query and returns the first result - #last(clause = "", params = [] of DB::Any)
- #prep_array_for_sql(strings : Array(String)) : String
- #prep_array_for_sql(ints : Array(Int64)) : String
- #query(clause = "", params = [] of DB::Any, &)
- #sanitize_string_for_sql(string : String) : String
- #scalar(clause = "", &)
Macro Summary
Instance Method Detail
All will return all rows in the database. The clause allows you to specify a WHERE, JOIN, GROUP BY, ORDER BY and any other SQL92 compatible query to your table. The results will be an array of instantiated instances of your Model class. This allows you to take full advantage of the database that you are using so you are not restricted or dummied down to support a DSL.
Clear is used to remove all rows from the table and reset the counter for the primary key.
find returns the row with the primary key specified. it checks by primary by default, but one can pass another field for comparison
find_by returns the first row found where the field maches the value
First adds a LIMIT 1
clause to the query and returns the first result