Class: Couchbase::Options::Analytics
- Defined in:
- lib/couchbase/options.rb
Overview
Options for Cluster#analytics_query
Constant Summary collapse
- DEFAULT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Analytics.new.freeze
Instance Attribute Summary collapse
- #client_context_id ⇒ String
- #priority ⇒ Boolean
- #readonly ⇒ Boolean
- #scan_consistency ⇒ Symbol
- #scope_qualifier ⇒ String
- #transcoder ⇒ JsonTranscoder, #decode(String)
Attributes inherited from Base
#client_context, #parent_span, #retry_strategy, #timeout
Instance Method Summary collapse
-
#initialize(client_context_id: nil, scan_consistency: nil, readonly: false, priority: nil, transcoder: JsonTranscoder.new, positional_parameters: nil, named_parameters: nil, scope_qualifier: nil, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ Analytics
constructor
Creates new instance of options for Cluster#analytics_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.
- #to_backend(scope_name: nil, bucket_name: nil) ⇒ Object private
Constructor Details
#initialize(client_context_id: nil, scan_consistency: nil, readonly: false, priority: nil, transcoder: JsonTranscoder.new, positional_parameters: nil, named_parameters: nil, scope_qualifier: nil, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ Analytics
Either positional_parameters
or named_parameters
may be specified.
Creates new instance of options for Cluster#analytics_query
1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 |
# File 'lib/couchbase/options.rb', line 1894 def initialize(client_context_id: nil, scan_consistency: nil, readonly: false, priority: nil, transcoder: JsonTranscoder.new, positional_parameters: nil, named_parameters: nil, scope_qualifier: 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) @client_context_id = client_context_id @scan_consistency = scan_consistency @readonly = readonly @priority = priority @transcoder = transcoder @positional_parameters = positional_parameters @named_parameters = named_parameters @scope_qualifier = scope_qualifier @raw_parameters = {} yield self if block_given? end |
Instance Attribute Details
#client_context_id ⇒ String
1852 1853 1854 |
# File 'lib/couchbase/options.rb', line 1852 def client_context_id @client_context_id end |
#priority ⇒ Boolean
1855 1856 1857 |
# File 'lib/couchbase/options.rb', line 1855 def priority @priority end |
#readonly ⇒ Boolean
1854 1855 1856 |
# File 'lib/couchbase/options.rb', line 1854 def readonly @readonly end |
#scan_consistency ⇒ Symbol
1853 1854 1855 |
# File 'lib/couchbase/options.rb', line 1853 def scan_consistency @scan_consistency end |
#scope_qualifier ⇒ String
1857 1858 1859 |
# File 'lib/couchbase/options.rb', line 1857 def scope_qualifier @scope_qualifier end |
#transcoder ⇒ JsonTranscoder, #decode(String)
1856 1857 1858 |
# File 'lib/couchbase/options.rb', line 1856 def transcoder @transcoder end |
Instance Method Details
#named_parameters(named) ⇒ Object
Sets named parameters for the query
1932 1933 1934 1935 |
# File 'lib/couchbase/options.rb', line 1932 def named_parameters(named) @named_parameters = named @positional_parameters = nil end |
#positional_parameters(positional) ⇒ Object
Sets positional parameters for the query
1924 1925 1926 1927 |
# File 'lib/couchbase/options.rb', line 1924 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
1941 1942 1943 |
# File 'lib/couchbase/options.rb', line 1941 def raw(key, value) @raw_parameters[key] = JSON.generate(value) end |
#to_backend(scope_name: nil, bucket_name: nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 |
# File 'lib/couchbase/options.rb', line 1946 def to_backend(scope_name: nil, bucket_name: nil) { timeout: Utils::Time.extract_duration(@timeout), client_context_id: @client_context_id, scan_consistency: @scan_consistency, readonly: @readonly, priority: @priority, positional_parameters: export_positional_parameters, named_parameters: export_named_parameters, raw_parameters: @raw_parameters, scope_qualifier: @scope_qualifier, scope_name: scope_name, bucket_name: bucket_name, } end |