2010-09-14 18:20:24 -04:00
|
|
|
module Arel
|
|
|
|
module Expressions
|
|
|
|
def count distinct = false
|
|
|
|
Nodes::Count.new [self], distinct
|
|
|
|
end
|
|
|
|
|
2014-07-31 08:49:57 -04:00
|
|
|
def sum
|
2014-10-31 10:40:28 -04:00
|
|
|
Nodes::Sum.new [self]
|
2010-09-14 18:20:24 -04:00
|
|
|
end
|
|
|
|
|
2014-07-31 08:49:57 -04:00
|
|
|
def maximum
|
2014-10-31 10:40:28 -04:00
|
|
|
Nodes::Max.new [self]
|
2010-09-14 18:20:24 -04:00
|
|
|
end
|
|
|
|
|
2014-07-31 08:49:57 -04:00
|
|
|
def minimum
|
2014-10-31 10:40:28 -04:00
|
|
|
Nodes::Min.new [self]
|
2010-09-14 18:20:24 -04:00
|
|
|
end
|
|
|
|
|
2014-07-31 08:49:57 -04:00
|
|
|
def average
|
2014-10-31 10:40:28 -04:00
|
|
|
Nodes::Avg.new [self]
|
2010-09-14 18:20:24 -04:00
|
|
|
end
|
2012-02-23 08:06:05 -05:00
|
|
|
|
|
|
|
def extract field
|
|
|
|
Nodes::Extract.new [self], field
|
|
|
|
end
|
2014-10-31 10:40:28 -04:00
|
|
|
|
2010-09-14 18:20:24 -04:00
|
|
|
end
|
|
|
|
end
|