class

Luna::Relation(T)

Inherits Reference < Object

Constructors

Instance methods

avg(column : String, as : TNum.class) : TNum | Nil forall TNum
Source
count(column : String = "*", distinct : Bool = false) : Int64
Source
exists?
Source
first
Source
includes(*incs : Symbol)
Source
includes

keywords only (THIS fixes includes(posts: :comments))

Source
includes(*incs : Symbol, **nested)

both

Source
inner_join(table : String, on : String, table_alias : String | Nil = nil)
Source
inner_join(table : String, on : String, *params : DB::Any, table_alias : String | Nil = nil)

Join DSL

Source
left_join(table : String, on : String, table_alias : String | Nil = nil)
Source
left_join(table : String, on : String, *params : DB::Any, table_alias : String | Nil = nil)
Source
limit(n : Int32)
Source
max(column : String, as : TVal.class) : TVal | Nil forall TVal
Source
min(column : String, as : TVal.class) : TVal | Nil forall TVal
Source
offset(n : Int32)
Source
order(*cols : String)
Source
pluck(column : String, as : TVal.class) : Array(TVal) forall TVal

Single-column pluck with static type

Source
select(*cols : String)

Projection / order / paging (proxy)

Source
sum(column : String, as : TNum.class) : TNum | Nil forall TNum

Numeric aggregates (typed)

Source
to_a
Source
to_sql
Source
where(filters : Hash(Symbol, DB::Any))
Source
where(filters : NamedTuple)
Source
where(cond : String, *params : DB::Any)

WHERE variants

Source
where_in(column : String, vals : Array(DB::Any))
Source