Class: Couchbase::Protostellar::RequestGenerator::Query Private
- Inherits:
-
Object
- Object
- Couchbase::Protostellar::RequestGenerator::Query
- Defined in:
- lib/couchbase/protostellar/request_generator/query.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- SCAN_CONSISTENCY_MAP =
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.
{ :not_bounded => :SCAN_CONSISTENCY_NOT_BOUNDED, :request_plus => :SCAN_CONSISTENCY_REQUEST_PLUS, }.freeze
- PROFILE_MODE_MAP =
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.
{ :off => :PROFILE_MODE_OFF, :phases => :PROFILE_MODE_PHASES, :timings => :PROFILE_MODE_TIMINGS, }.freeze
Instance Attribute Summary collapse
- #bucket_name ⇒ Object readonly private
- #scope_name ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(bucket_name: nil, scope_name: nil) ⇒ Query
constructor
private
A new instance of Query.
- #query_request(statement, options) ⇒ Object private
Constructor Details
#initialize(bucket_name: nil, scope_name: nil) ⇒ Query
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.
Returns a new instance of Query.
41 42 43 44 |
# File 'lib/couchbase/protostellar/request_generator/query.rb', line 41 def initialize(bucket_name: nil, scope_name: nil) @bucket_name = bucket_name @scope_name = scope_name end |
Instance Attribute Details
#bucket_name ⇒ Object (readonly)
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.
38 39 40 |
# File 'lib/couchbase/protostellar/request_generator/query.rb', line 38 def bucket_name @bucket_name end |
#scope_name ⇒ Object (readonly)
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.
39 40 41 |
# File 'lib/couchbase/protostellar/request_generator/query.rb', line 39 def scope_name @scope_name end |
Instance Method Details
#query_request(statement, options) ⇒ 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.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/couchbase/protostellar/request_generator/query.rb', line 46 def query_request(statement, ) proto_opts = {} bucket_name = @bucket_name scope_name = @scope_name unless .scope_qualifier.nil? if .scope_qualifier.include? ":" bucket_name, scope_name = .scope_qualifier.split(":")[1].split(".") else bucket_name, scope_name = .scope_qualifier.split(".") end end proto_opts[:scope_name] = scope_name unless scope_name.nil? proto_opts[:bucket_name] = bucket_name unless bucket_name.nil? proto_opts[:read_only] = .readonly unless .readonly.nil? proto_opts[:prepared] = !.adhoc tuning_opts = () proto_opts[:tuning_options] = tuning_opts unless tuning_opts.nil? proto_opts[:client_context_id] = .client_context_id unless .client_context_id.nil? unless .instance_variable_get(:@scan_consistency).nil? proto_opts[:scan_consistency] = SCAN_CONSISTENCY_MAP[.instance_variable_get(:@scan_consistency)] end proto_opts[:positional_parameters] = .export_positional_parameters unless .export_positional_parameters.nil? proto_opts[:named_parameters] = .export_named_parameters unless .export_named_parameters.nil? proto_opts[:flex_index] = .flex_index unless .flex_index.nil? proto_opts[:preserve_expiry] = .preserve_expiry unless .preserve_expiry.nil? proto_opts[:consistent_with] = get_consistent_with() unless .mutation_state.nil? proto_opts[:profile_mode] = PROFILE_MODE_MAP[.profile] proto_req = Generated::Query::V1::QueryRequest.new( statement: statement, **proto_opts ) create_query_request(proto_req, :query, , idempotent: .readonly && true) end |