Skip to content

Commit

Permalink
Add scopes for negative matches
Browse files Browse the repository at this point in the history
  • Loading branch information
exAspArk committed Apr 26, 2024
1 parent 88c295d commit e031498
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/bemi/change_query_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ module Bemi::ChangeQueryHelpers

included do
scope :before, ->(hash) { where('before @> ?', hash.to_json) }
scope :before_not, ->(hash) { where.not('before @> ?', hash.to_json) }
scope :after, ->(hash) { where('after @> ?', hash.to_json) }
scope :after_not, ->(hash) { where.not('after @> ?', hash.to_json) }
scope :context, ->(hash) { where('context @> ?', hash.to_json) }
scope :context_not, ->(hash) { where.not('context @> ?', hash.to_json) }

scope :created, -> { where(operation: 'CREATE') }
scope :updated, -> { where(operation: 'UPDATE') }
Expand Down

0 comments on commit e031498

Please sign in to comment.