Class: Couchbase::Options::Upsert
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
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 |
# File 'lib/couchbase/options.rb', line 663 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 = 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
622 623 624 |
# File 'lib/couchbase/options.rb', line 622 def durability_level @durability_level end |
#expiry ⇒ Integer, ...
620 621 622 |
# File 'lib/couchbase/options.rb', line 620 def expiry @expiry end |
#preserve_expiry ⇒ Boolean
623 624 625 |
# File 'lib/couchbase/options.rb', line 623 def preserve_expiry @preserve_expiry end |
#transcoder ⇒ JsonTranscoder, #encode(Object)
621 622 623 |
# File 'lib/couchbase/options.rb', line 621 def transcoder @transcoder end |
Instance Method Details
#to_backend ⇒ Object
687 688 689 690 691 692 693 694 695 696 |
# File 'lib/couchbase/options.rb', line 687 def to_backend { timeout: Utils::Time.extract_duration(@timeout), expiry: Utils::Time.extract_expiry_time(@expiry), preserve_expiry: @preserve_expiry, durability_level: @durability_level, persist_to: @persist_to, replicate_to: @replicate_to, } end |