Method: Sequel::ExcludeOrNull#exclude_or_null

Defined in:
lib/sequel/extensions/exclude_or_null.rb

#exclude_or_null(*cond, &block) ⇒ Object

Performs the inverse of Dataset#where, but also excludes rows where the given condition IS NULL.

DB[:items].exclude_or_null(category: 'software')
# SELECT * FROM items WHERE NOT coalesce((category = 'software'), false)

DB[:items].exclude_or_null(category: 'software', id: 3)
# SELECT * FROM items WHERE NOT coalesce(((category = 'software') AND (id = 3)), false)
[View source]

41
42
43
# File 'lib/sequel/extensions/exclude_or_null.rb', line 41

def exclude_or_null(*cond, &block)
  add_filter(:where, cond, :or_null, &block)
end