module

Rome::Query

Most methods are delegated to a Collection(T) object.

Instance methods

average(column_name : Symbol | String) : Float64
Source
count(column_name : Symbol | String = "*", distinct = false) : Int64
Source
distinct(value = true) : Collection(self)
Source
exists?(id) : Bool
Source
find(id) : self
Source
find?(id) : self | Nil
Source
find_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
Source
find_by
Source
find_by?
Source
find_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.

Source
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.

Source
first
Source
first?
Source
last
Source
last?
Source
limit(value : Int32) : Collection(self)
Source
maximum(column_name : Symbol | String)
Source
minimum(column_name : Symbol | String)
Source
none
Source
offset(value : Int32) : Collection(self)
Source
order(columns : Hash(Symbol, Symbol)) : Collection(self)
Source
order(*columns : Symbol | String) : Collection(self)
Source
order
Source
pluck(column_name : Symbol | String) : Array(Value)
Source
reorder(columns : Hash(Symbol, Symbol)) : Collection(self)
Source
reorder(*columns : Symbol | String) : Collection(self)
Source
reorder
Source
select(sql : String) : Collection(self)
Source
select(*columns : Symbol) : Collection(self)
Source
sum(column_name : Symbol | String) : Int64 | Float64
Source
take
Source
take?
Source
where(conditions : Hash(Symbol, Value | Array(Value)) | NamedTuple) : Collection(self)
Source
where(sql : String, *args : Value) : Collection(self)
Source
where
Source
where_not(conditions : Hash(Symbol, Value | Array(Value)) | NamedTuple) : Collection(self)
Source
where_not
Source

Nested types