aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/expressions.rb
blob: fa18f15b6770b620d0d33f9bc38a602d6f5c24ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module Arel
  module Expressions
    def count distinct = false
      Nodes::Count.new [self], distinct
    end

    def sum
      Nodes::Sum.new [self], Nodes::SqlLiteral.new('sum_id')
    end

    def maximum
      Nodes::Max.new [self], Nodes::SqlLiteral.new('max_id')
    end

    def minimum
      Nodes::Min.new [self], Nodes::SqlLiteral.new('min_id')
    end

    def average
      Nodes::Avg.new [self], Nodes::SqlLiteral.new('avg_id')
    end

    def extract field
      Nodes::Extract.new [self], field
    end
  end
end