Rome::Query
Most methods are delegated to a Collection(T) object.
Instance methods
all
Sourceaverage(column_name : Symbol | String) : Float64
Sourcecount(column_name : Symbol | String = "*", distinct = false) : Int64
Sourcedistinct(value = true) : Collection(self)
Sourceexists?(id) : Bool
Sourcefind(id) : self
Sourcefind?(id) : self | Nil
Sourcefind_all_by_sql(sql : String, *args) : Array(self)
Loads records by raw SQL query. You may refer to arguments with ? in the
SQL query, and pass them to the method. For example:
users = User.find_all_by_sql(<<-SQL, "julien")
SELECT * FROM "users" WHERE username = ?
SQL
find_by
Sourcefind_by?
Sourcefind_one_by_sql(sql : String, *args) : self
Loads one record by raw SQL query. You may refer to arguments with ? in
the SQL query, and pass them to the method. For example:
user = User.find_one_by_sql(<<-SQL, "julien")
SELECT * FROM "users" WHERE username = ? LIMIT 1
SQL
Raises a RecordNotFound exception when no record could be found in the
database.
find_one_by_sql?(sql : String, *args) : self | Nil
Same as #find_one_by_sql but returns nil when no record could be found
in the database.
first
Sourcefirst?
Sourceids
Sourcelast
Sourcelast?
Sourcelimit(value : Int32) : Collection(self)
Sourcemaximum(column_name : Symbol | String)
Sourceminimum(column_name : Symbol | String)
Sourcenone
Sourceoffset(value : Int32) : Collection(self)
Sourceorder(columns : Hash(Symbol, Symbol)) : Collection(self)
Sourceorder(*columns : Symbol | String) : Collection(self)
Sourceorder
Sourcepluck(column_name : Symbol | String) : Array(Value)
Sourcereorder(columns : Hash(Symbol, Symbol)) : Collection(self)
Sourcereorder(*columns : Symbol | String) : Collection(self)
Sourcereorder
Sourceselect(sql : String) : Collection(self)
Sourceselect(*columns : Symbol) : Collection(self)
Sourcesum(column_name : Symbol | String) : Int64 | Float64
Sourcetake
Sourcetake?
Sourcewhere(conditions : Hash(Symbol, Value | Array(Value)) | NamedTuple) : Collection(self)
Sourcewhere(sql : String, *args : Value) : Collection(self)
Sourcewhere
Sourcewhere_not(conditions : Hash(Symbol, Value | Array(Value)) | NamedTuple) : Collection(self)
Sourcewhere_not
Source