aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/arel/expressions.rb
blob: 597b861b6c44afa3d469409e3b9f6d67f19c96bd (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
28
29
# frozen_string_literal: true

module Arel
  module Expressions
    def count(distinct = false)
      Nodes::Count.new [self], distinct
    end

    def sum
      Nodes::Sum.new [self]
    end

    def maximum
      Nodes::Max.new [self]
    end

    def minimum
      Nodes::Min.new [self]
    end

    def average
      Nodes::Avg.new [self]
    end

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