Method: Sequel::SQL::Function#filter

Defined in:
lib/sequel/sql.rb

#filter(*args, &block) ⇒ Object

Return a new function with FILTER added to it, for filtered aggregate functions:

Sequel.function(:foo, :col).filter(a: 1) # foo(col) FILTER (WHERE (a = 1))


1417
1418
1419
1420
1421
1422
1423
1424
1425
# File 'lib/sequel/sql.rb', line 1417

def filter(*args, &block)
  if args.length == 1
    args = args.first
  else
    args.freeze
  end

  with_opts(:filter=>args, :filter_block=>block)
end