Module: Rooq::Aggregates
- Extended by:
- T::Sig
- Defined in:
- lib/rooq/expression.rb
Overview
Aggregate functions
Class Method Summary collapse
- .array_agg(expression, distinct: false) ⇒ FunctionCall
- .avg(expression, distinct: false) ⇒ FunctionCall
- .count(expression = nil, distinct: false) ⇒ FunctionCall
- .max(expression) ⇒ FunctionCall
- .min(expression) ⇒ FunctionCall
- .string_agg(expression, delimiter, distinct: false) ⇒ FunctionCall
- .sum(expression, distinct: false) ⇒ FunctionCall
Class Method Details
.array_agg(expression, distinct: false) ⇒ FunctionCall
222 223 224 |
# File 'lib/rooq/expression.rb', line 222 def array_agg(expression, distinct: false) FunctionCall.new(:array_agg, expression, distinct: distinct) end |
.avg(expression, distinct: false) ⇒ FunctionCall
207 208 209 |
# File 'lib/rooq/expression.rb', line 207 def avg(expression, distinct: false) FunctionCall.new(:avg, expression, distinct: distinct) end |
.count(expression = nil, distinct: false) ⇒ FunctionCall
196 197 198 199 |
# File 'lib/rooq/expression.rb', line 196 def count(expression = nil, distinct: false) expression ||= Literal.new(:*) FunctionCall.new(:count, expression, distinct: distinct) end |
.max(expression) ⇒ FunctionCall
217 218 219 |
# File 'lib/rooq/expression.rb', line 217 def max(expression) FunctionCall.new(:max, expression) end |
.min(expression) ⇒ FunctionCall
212 213 214 |
# File 'lib/rooq/expression.rb', line 212 def min(expression) FunctionCall.new(:min, expression) end |
.string_agg(expression, delimiter, distinct: false) ⇒ FunctionCall
227 228 229 |
# File 'lib/rooq/expression.rb', line 227 def string_agg(expression, delimiter, distinct: false) FunctionCall.new(:string_agg, expression, delimiter, distinct: distinct) end |
.sum(expression, distinct: false) ⇒ FunctionCall
202 203 204 |
# File 'lib/rooq/expression.rb', line 202 def sum(expression, distinct: false) FunctionCall.new(:sum, expression, distinct: distinct) end |