Class: Couchbase::BinaryCollection
- Inherits:
-
Object
- Object
- Couchbase::BinaryCollection
- Defined in:
- lib/couchbase/binary_collection.rb,
lib/couchbase/binary_collection_options.rb,
/home/runner/work/couchbase-ruby-client/couchbase-ruby-client/lib/couchbase/binary_collection.rb,
/home/runner/work/couchbase-ruby-client/couchbase-ruby-client/lib/couchbase/binary_collection_options.rb
Overview
Allows to perform certain operations on non-JSON documents.
Defined Under Namespace
Classes: CounterResult
Instance Method Summary collapse
-
#append(id, content, options = Options::Append::DEFAULT) ⇒ Collection::MutationResult
Appends binary content to the document.
-
#decrement(id, options = Options::Decrement::DEFAULT) ⇒ CounterResult
Decrements the counter document by one of the number defined in the options.
-
#increment(id, options = Options::Increment::DEFAULT) ⇒ CounterResult
Increments the counter document by one of the number defined in the options.
-
#prepend(id, content, options = Options::Prepend::DEFAULT) ⇒ Collection::MutationResult
Prepends binary content to the document.
Instance Method Details
#append(id, content, options = Options::Append::DEFAULT) ⇒ Collection::MutationResult
Appends binary content to the document
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/couchbase/binary_collection.rb', line 46 def append(id, content, = Options::Append::DEFAULT) @observability.record_operation(Observability::OP_APPEND, .parent_span, self, :kv) do |obs_handler| obs_handler.add_durability_level(.durability_level) resp = @backend.document_append(@collection.bucket_name, @collection.scope_name, @collection.name, id, content, .to_backend, obs_handler) Collection::MutationResult.new do |res| res.cas = resp[:cas] res.mutation_token = @collection.send(:extract_mutation_token, resp) end end end |
#decrement(id, options = Options::Decrement::DEFAULT) ⇒ CounterResult
Decrements the counter document by one of the number defined in the options
119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/couchbase/binary_collection.rb', line 119 def decrement(id, = Options::Decrement::DEFAULT) @observability.record_operation(Observability::OP_DECREMENT, .parent_span, self, :kv) do |obs_handler| obs_handler.add_durability_level(.durability_level) resp = @backend.document_decrement(@collection.bucket_name, @collection.scope_name, @collection.name, id, .to_backend, obs_handler) CounterResult.new do |res| res.cas = resp[:cas] res.content = resp[:content] res.mutation_token = @collection.send(:extract_mutation_token, resp) end end end |
#increment(id, options = Options::Increment::DEFAULT) ⇒ CounterResult
Increments the counter document by one of the number defined in the options
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/couchbase/binary_collection.rb', line 94 def increment(id, = Options::Increment::DEFAULT) @observability.record_operation(Observability::OP_INCREMENT, .parent_span, self, :kv) do |obs_handler| obs_handler.add_durability_level(.durability_level) resp = @backend.document_increment(@collection.bucket_name, @collection.scope_name, @collection.name, id, .to_backend, obs_handler) CounterResult.new do |res| res.cas = resp[:cas] res.content = resp[:content] res.mutation_token = @collection.send(:extract_mutation_token, resp) end end end |
#prepend(id, content, options = Options::Prepend::DEFAULT) ⇒ Collection::MutationResult
Prepends binary content to the document
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/couchbase/binary_collection.rb', line 70 def prepend(id, content, = Options::Prepend::DEFAULT) @observability.record_operation(Observability::OP_PREPEND, .parent_span, self, :kv) do |obs_handler| obs_handler.add_durability_level(.durability_level) resp = @backend.document_prepend(@collection.bucket_name, @collection.scope_name, @collection.name, id, content, .to_backend, obs_handler) Collection::MutationResult.new do |res| res.cas = resp[:cas] res.mutation_token = @collection.send(:extract_mutation_token, resp) end end end |