Class: Couchbase::Options::Query
Overview
Options for Cluster#query
Instance Attribute Summary collapse
- #adhoc ⇒ Boolean
- #client_context_id ⇒ String
- #flex_index ⇒ Boolean
- #max_parallelism ⇒ Integer
- #metrics ⇒ Boolean
- #pipeline_batch ⇒ Integer
- #pipeline_cap ⇒ Integer
- #preserve_expiry ⇒ Boolean
- #profile ⇒ Symbol
- #readonly ⇒ Boolean
- #scan_cap ⇒ Integer
- #scan_wait ⇒ Integer, #in_milliseconds
- #scope_qualifier ⇒ String
- #transcoder ⇒ JsonTranscoder, #decode(String)
- #use_replica ⇒ Boolean?
Attributes inherited from Base
#client_context, #parent_span, #retry_strategy, #timeout
Instance Method Summary collapse
-
#consistent_with(mutation_state) ⇒ Object
Sets the mutation tokens this query should be consistent with.
-
#initialize(adhoc: true, client_context_id: nil, max_parallelism: nil, readonly: false, scan_wait: nil, scan_cap: nil, pipeline_cap: nil, pipeline_batch: nil, metrics: nil, profile: :off, flex_index: nil, preserve_expiry: nil, use_replica: nil, scope_qualifier: nil, scan_consistency: :not_bounded, mutation_state: nil, transcoder: JsonTranscoder.new, positional_parameters: nil, named_parameters: nil, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ Query
constructor
Creates new instance of options for Cluster#query.
-
#named_parameters(named) ⇒ Object
Sets named parameters for the query.
-
#positional_parameters(positional) ⇒ Object
Sets positional parameters for the query.
-
#raw(key, value) ⇒ Object
Allows providing custom JSON key/value pairs for advanced usage.
-
#scan_consistency=(level) ⇒ Object
Customizes the consistency guarantees for this query.
Constructor Details
#initialize(adhoc: true, client_context_id: nil, max_parallelism: nil, readonly: false, scan_wait: nil, scan_cap: nil, pipeline_cap: nil, pipeline_batch: nil, metrics: nil, profile: :off, flex_index: nil, preserve_expiry: nil, use_replica: nil, scope_qualifier: nil, scan_consistency: :not_bounded, mutation_state: nil, transcoder: JsonTranscoder.new, positional_parameters: nil, named_parameters: nil, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ Query
Either positional_parameters
or named_parameters
may be specified.
Creates new instance of options for Cluster#query
2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 |
# File 'lib/couchbase/options.rb', line 2067 def initialize(adhoc: true, client_context_id: nil, max_parallelism: nil, readonly: false, scan_wait: nil, scan_cap: nil, pipeline_cap: nil, pipeline_batch: nil, metrics: nil, profile: :off, flex_index: nil, preserve_expiry: nil, use_replica: nil, scope_qualifier: nil, scan_consistency: :not_bounded, mutation_state: nil, transcoder: JsonTranscoder.new, positional_parameters: nil, named_parameters: nil, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) raise ArgumentError, "Cannot pass positional and named parameters at the same time" if positional_parameters && named_parameters super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span) @adhoc = adhoc @client_context_id = client_context_id @max_parallelism = max_parallelism @readonly = readonly @scan_wait = scan_wait @scan_cap = scan_cap @pipeline_cap = pipeline_cap @pipeline_batch = pipeline_batch @metrics = metrics @profile = profile @flex_index = flex_index @preserve_expiry = preserve_expiry @use_replica = use_replica @scope_qualifier = scope_qualifier @scan_consistency = scan_consistency @mutation_state = mutation_state @transcoder = transcoder @positional_parameters = positional_parameters @named_parameters = named_parameters @raw_parameters = {} yield self if block_given? end |
Instance Attribute Details
#adhoc ⇒ Boolean
1988 1989 1990 |
# File 'lib/couchbase/options.rb', line 1988 def adhoc @adhoc end |
#client_context_id ⇒ String
1989 1990 1991 |
# File 'lib/couchbase/options.rb', line 1989 def client_context_id @client_context_id end |
#flex_index ⇒ Boolean
1998 1999 2000 |
# File 'lib/couchbase/options.rb', line 1998 def flex_index @flex_index end |
#max_parallelism ⇒ Integer
1990 1991 1992 |
# File 'lib/couchbase/options.rb', line 1990 def max_parallelism @max_parallelism end |
#metrics ⇒ Boolean
1996 1997 1998 |
# File 'lib/couchbase/options.rb', line 1996 def metrics @metrics end |
#pipeline_batch ⇒ Integer
1994 1995 1996 |
# File 'lib/couchbase/options.rb', line 1994 def pipeline_batch @pipeline_batch end |
#pipeline_cap ⇒ Integer
1995 1996 1997 |
# File 'lib/couchbase/options.rb', line 1995 def pipeline_cap @pipeline_cap end |
#preserve_expiry ⇒ Boolean
1999 2000 2001 |
# File 'lib/couchbase/options.rb', line 1999 def preserve_expiry @preserve_expiry end |
#profile ⇒ Symbol
1997 1998 1999 |
# File 'lib/couchbase/options.rb', line 1997 def profile @profile end |
#readonly ⇒ Boolean
1991 1992 1993 |
# File 'lib/couchbase/options.rb', line 1991 def readonly @readonly end |
#scan_cap ⇒ Integer
1993 1994 1995 |
# File 'lib/couchbase/options.rb', line 1993 def scan_cap @scan_cap end |
#scan_wait ⇒ Integer, #in_milliseconds
1992 1993 1994 |
# File 'lib/couchbase/options.rb', line 1992 def scan_wait @scan_wait end |
#scope_qualifier ⇒ String
2001 2002 2003 |
# File 'lib/couchbase/options.rb', line 2001 def scope_qualifier @scope_qualifier end |
#transcoder ⇒ JsonTranscoder, #decode(String)
2002 2003 2004 |
# File 'lib/couchbase/options.rb', line 2002 def transcoder @transcoder end |
#use_replica ⇒ Boolean?
2000 2001 2002 |
# File 'lib/couchbase/options.rb', line 2000 def use_replica @use_replica end |
Instance Method Details
#consistent_with(mutation_state) ⇒ Object
overrides consistency level set by #scan_consistency=
Sets the mutation tokens this query should be consistent with
2145 2146 2147 2148 |
# File 'lib/couchbase/options.rb', line 2145 def consistent_with(mutation_state) @scan_consistency = nil if @scan_consistency @mutation_state = mutation_state end |
#named_parameters(named) ⇒ Object
Sets named parameters for the query
2167 2168 2169 2170 |
# File 'lib/couchbase/options.rb', line 2167 def named_parameters(named) @named_parameters = named @positional_parameters = nil end |
#positional_parameters(positional) ⇒ Object
Sets positional parameters for the query
2153 2154 2155 2156 |
# File 'lib/couchbase/options.rb', line 2153 def positional_parameters(positional) @positional_parameters = positional @named_parameters = nil end |
#raw(key, value) ⇒ Object
Allows providing custom JSON key/value pairs for advanced usage
2120 2121 2122 |
# File 'lib/couchbase/options.rb', line 2120 def raw(key, value) @raw_parameters[key] = JSON.generate(value) end |
#scan_consistency=(level) ⇒ Object
overrides consistency level set by #consistent_with
Customizes the consistency guarantees for this query
:not_bounded
-
The indexer will return whatever state it has to the query engine at the time of query. This is the default (for
single-statement requests).
:request_plus
-
The indexer will wait until all mutations have been processed at the time of request before returning to the query
engine.
2135 2136 2137 2138 |
# File 'lib/couchbase/options.rb', line 2135 def scan_consistency=(level) @mutation_state = nil if @mutation_state @scan_consistency = level end |