Method: Couchbase::Protostellar::RequestGenerator::Query#query_request
- Defined in:
- lib/couchbase/protostellar/request_generator/query.rb
#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) end |