Public Instance methods
exclude_or_null(*cond, &block)
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)
[show source]
# File lib/sequel/extensions/exclude_or_null.rb 41 def exclude_or_null(*cond, &block) 42 add_filter(:where, cond, :or_null, &block) 43 end
exclude_or_null_having(*cond, &block)
The same as exclude_or_null
, but affecting the HAVING clause instead of the WHERE clause.
DB[:items].select_group(:name).exclude_or_null_having{count(name) < 2} # SELECT name FROM items GROUP BY name HAVING NOT coalesce((count(name) < 2), true)
[show source]
# File lib/sequel/extensions/exclude_or_null.rb 50 def exclude_or_null_having(*cond, &block) 51 add_filter(:having, cond, :or_null, &block) 52 end