Class: Couchbase::Options::Upsert
- Defined in:
- lib/couchbase/options.rb,
/Users/sergey.auseyau/code/couchbase-ruby-client/lib/couchbase/options.rb more...
Overview
Options for Collection#upsert
Instance Attribute Summary collapse
- #durability_level ⇒ Symbol
- #expiry ⇒ Integer, ...
- #preserve_expiry ⇒ Boolean
- #transcoder ⇒ JsonTranscoder, #encode(Object)
Attributes inherited from Base
#client_context, #parent_span, #retry_strategy, #timeout
Instance Method Summary collapse
-
#initialize(expiry: nil, preserve_expiry: false, transcoder: JsonTranscoder.new, durability_level: :none, replicate_to: :none, persist_to: :none, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|| ... } ⇒ Upsert
constructor
Creates an instance of options for Collection#upsert.
- #to_backend ⇒ Object
Constructor Details
#initialize(expiry: nil, preserve_expiry: false, transcoder: JsonTranscoder.new, durability_level: :none, replicate_to: :none, persist_to: :none, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|| ... } ⇒ Upsert
Creates an instance of options for Collection#upsert
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 |
# File 'lib/couchbase/options.rb', line 660 def initialize(expiry: nil, preserve_expiry: false, transcoder: JsonTranscoder.new, durability_level: :none, replicate_to: :none, persist_to: :none, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span) @expiry = Utils::Time.extract_expiry_time(expiry) @preserve_expiry = preserve_expiry @transcoder = transcoder if durability_level != :none && (replicate_to != :none || persist_to != :none) raise ArgumentError, "durability_level conflicts with replicate_to and persist_to options" end @persist_to = persist_to @replicate_to = replicate_to @durability_level = durability_level yield self if block_given? end |
Instance Attribute Details
#durability_level ⇒ Symbol
619 620 621 |
# File 'lib/couchbase/options.rb', line 619 def durability_level @durability_level end |
#expiry ⇒ Integer, ...
617 618 619 |
# File 'lib/couchbase/options.rb', line 617 def expiry @expiry end |
#preserve_expiry ⇒ Boolean
620 621 622 |
# File 'lib/couchbase/options.rb', line 620 def preserve_expiry @preserve_expiry end |
#transcoder ⇒ JsonTranscoder, #encode(Object)
618 619 620 |
# File 'lib/couchbase/options.rb', line 618 def transcoder @transcoder end |
Instance Method Details
#to_backend ⇒ Object
[View source]
684 685 686 687 688 689 690 691 692 693 |
# File 'lib/couchbase/options.rb', line 684 def to_backend { timeout: Utils::Time.extract_duration(@timeout), expiry: @expiry, preserve_expiry: @preserve_expiry, durability_level: @durability_level, persist_to: @persist_to, replicate_to: @replicate_to, } end |