Module: Gitlab::Database::BatchCount

Extended by:
BatchCount
Included in:
BatchCount
Defined in:
lib/gitlab/database/batch_count.rb

Instance Method Summary collapse

Instance Method Details

#batch_count(relation, column = nil, batch_size: nil, start: nil, finish: nil) ⇒ Object


23
24
25
# File 'lib/gitlab/database/batch_count.rb', line 23

def batch_count(relation, column = nil, batch_size: nil, start: nil, finish: nil)
  BatchCounter.new(relation, column: column).count(batch_size: batch_size, start: start, finish: finish)
end

#batch_distinct_count(relation, column = nil, batch_size: nil, start: nil, finish: nil) ⇒ Object


27
28
29
# File 'lib/gitlab/database/batch_count.rb', line 27

def batch_distinct_count(relation, column = nil, batch_size: nil, start: nil, finish: nil)
  BatchCounter.new(relation, column: column).count(mode: :distinct, batch_size: batch_size, start: start, finish: finish)
end

#batch_sum(relation, column, batch_size: nil, start: nil, finish: nil) ⇒ Object


31
32
33
# File 'lib/gitlab/database/batch_count.rb', line 31

def batch_sum(relation, column, batch_size: nil, start: nil, finish: nil)
  BatchCounter.new(relation, column: nil, operation: :sum, operation_args: [column]).count(batch_size: batch_size, start: start, finish: finish)
end