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))


1411
1412
1413
1414
1415
1416
1417
1418
1419
# File 'lib/sequel/sql.rb', line 1411

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

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