Skip to content

Commit

Permalink
add upsert_multi
Browse files Browse the repository at this point in the history
  • Loading branch information
Giallombardo Nathan committed Jul 30, 2024
1 parent d76254a commit 16a1e86
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/couchbase-orm/proxies/collection_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ def remove_multi(ids, **options)
result.reject(&:error)
end

def upsert_multi!(id_content, **options)
result = @proxyfied.upsert_multi(id_content, Couchbase::Options::UpsertMulti.new(**options))
first_result_with_error = result.find(&:error)
raise first_result_with_error.error if first_result_with_error

result
end

def upsert_multi(id_content, **options)
result = @proxyfied.upsert_multi(id_content, Couchbase::Options::UpsertMulti.new(**options))
result.reject(&:error)
end

def initialize(proxyfied)
raise ArgumentError.new('Must proxy a non nil object') if proxyfied.nil?

Expand Down

0 comments on commit 16a1e86

Please sign in to comment.