37class tao_json_serializer;
71 std::map<std::string, codec::binary, std::less<>>
raw;
104 positional_parameters_,
370 client_context_id_.reset();
402 mutation_state_.clear();
428 mutation_state_ = state.tokens();
429 scan_consistency_.reset();
445 std::enable_if_t<codec::is_serializer_v<Serializer>,
bool> =
true>
448 raw_[std::move(name)] = std::move(Serializer::template serialize<const Value&>(value));
463 typename... Parameters,
464 std::enable_if_t<codec::is_serializer_v<Serializer>,
bool> =
true>
467 named_parameters_.clear();
468 positional_parameters_.clear();
469 encode_positional_parameters<Serializer>(parameters...);
484 typename... Parameters,
485 std::enable_if_t<codec::is_serializer_v<Serializer>,
bool> =
true>
488 named_parameters_.clear();
489 positional_parameters_.clear();
490 encode_named_parameters<Serializer>(parameters...);
511 raw_ = std::move(options);
532 named_parameters_.clear();
533 positional_parameters_ = std::move(parameters);
554 named_parameters_ = std::move(parameters);
555 positional_parameters_.clear();
563 std::enable_if_t<codec::is_serializer_v<Serializer>,
bool> =
true>
564 void encode_positional_parameters(
const Parameter& parameter, Rest... args)
566 positional_parameters_.emplace_back(
567 std::move(Serializer::template serialize<const Parameter&>(parameter)));
568 if constexpr (
sizeof...(args) > 0) {
569 encode_positional_parameters<Serializer>(args...);
573 template<
typename Serializer = codec::tao_json_serializer,
577 std::enable_if_t<codec::is_serializer_v<Serializer>,
bool> =
true>
578 void encode_named_parameters(
const std::pair<Name, Parameter>& parameter, Rest... args)
580 named_parameters_[parameter.first] =
581 std::move(Serializer::template serialize<Parameter>(parameter.second));
582 if constexpr (
sizeof...(args) > 0) {
583 encode_named_parameters<Serializer>(args...);
588 bool metrics_{
false };
589 bool readonly_{
false };
590 bool flex_index_{
false };
591 bool preserve_expiry_{
false };
592 std::optional<bool> use_replica_{};
593 std::optional<std::uint64_t> max_parallelism_{};
594 std::optional<std::uint64_t> scan_cap_{};
595 std::optional<std::uint64_t> pipeline_batch_{};
596 std::optional<std::uint64_t> pipeline_cap_{};
597 std::optional<std::string> client_context_id_{};
598 std::optional<std::chrono::milliseconds> scan_wait_{};
599 std::optional<query_scan_consistency> scan_consistency_{};
600 std::vector<mutation_token> mutation_state_{};
601 std::optional<query_profile> profile_{};
602 std::vector<codec::binary> positional_parameters_{};
603 std::map<std::string, codec::binary, std::less<>> raw_{};
604 std::map<std::string, codec::binary, std::less<>> named_parameters_{};
Definition tao_json_serializer.hxx:42
Common options that used by most operations.
Definition common_options.hxx:38
auto self() -> query_options &
Definition common_options.hxx:116
auto build_common_options() const -> built
Definition common_options.hxx:103
Aggregation of one or more mutation_tokens for specifying consistency requirements of N1QL or FTS que...
Definition mutation_state.hxx:35
Represents result of cluster::query() and scope::query() calls.
Definition query_result.hxx:42
std::vector< std::byte > binary
Definition encoded_value.hxx:25
Represents a single item from the result of collection::scan()
Definition allow_querying_search_index_options.hxx:28
query_profile
Definition query_profile.hxx:22
query_scan_consistency
Definition query_scan_consistency.hxx:22
@ not_bounded
The indexer will return whatever state it has to the query engine at the time of query.
std::function< void(error, query_result)> query_handler
The signature for the handler of the cluster::query() and scope::query() operations.
Definition query_options.hxx:613
Immutable value object representing consistent options.
Definition query_options.hxx:53
std::vector< mutation_token > mutation_state
Definition query_options.hxx:67
std::optional< std::uint64_t > max_parallelism
Definition query_options.hxx:60
std::map< std::string, codec::binary, std::less<> > named_parameters
Definition query_options.hxx:70
const bool metrics
Definition query_options.hxx:55
std::optional< query_scan_consistency > scan_consistency
Definition query_options.hxx:66
std::optional< query_profile > profile
Definition query_options.hxx:68
const bool readonly
Definition query_options.hxx:56
std::optional< std::chrono::milliseconds > scan_wait
Definition query_options.hxx:62
std::map< std::string, codec::binary, std::less<> > raw
Definition query_options.hxx:71
const bool adhoc
Definition query_options.hxx:54
std::optional< std::uint64_t > scan_cap
Definition query_options.hxx:61
std::optional< std::string > client_context_id
Definition query_options.hxx:65
std::optional< bool > use_replica
Definition query_options.hxx:59
const bool flex_index
Definition query_options.hxx:57
const bool preserve_expiry
Definition query_options.hxx:58
std::vector< codec::binary > positional_parameters
Definition query_options.hxx:69
std::optional< std::uint64_t > pipeline_batch
Definition query_options.hxx:63
std::optional< std::uint64_t > pipeline_cap
Definition query_options.hxx:64
Options for cluster::query() and scope::query().
Definition query_options.hxx:46
auto client_context_id(std::string client_context_id) -> query_options &
Supports providing a custom client context ID for this query.
Definition query_options.hxx:367
auto named_parameters(const Parameters &... parameters) -> query_options &
Set list of named parameters for a query.
Definition query_options.hxx:486
auto preserve_expiry(bool preserve_expiry) -> query_options &
Tells the query engine to preserve expiration values set on any documents modified by this query.
Definition query_options.hxx:236
auto encoded_raw_options(std::map< std::string, codec::binary, std::less<> > options) -> query_options &
Set map of raw options for a query.
Definition query_options.hxx:508
auto metrics(bool metrics) -> query_options &
Enables per-request metrics in the trailing section of the query.
Definition query_options.hxx:148
auto max_parallelism(std::uint64_t max_parallelism) -> query_options &
Allows overriding the default maximum parallelism for the query execution on the server side.
Definition query_options.hxx:271
auto encoded_named_parameters(std::map< std::string, codec::binary, std::less<> > parameters) -> query_options &
Set map of named parameters for a query.
Definition query_options.hxx:551
auto raw(std::string name, const Value &value) -> query_options &
Definition query_options.hxx:446
auto pipeline_cap(std::uint64_t pipeline_cap) -> query_options &
Allows customizing the maximum number of items each execution operator can buffer between various ope...
Definition query_options.hxx:349
auto build() const -> built
Validates options and returns them as an immutable value.
Definition query_options.hxx:85
auto scan_wait(std::chrono::milliseconds wait) -> query_options &
Allows customizing how long the query engine is willing to wait until the index catches up to whateve...
Definition query_options.hxx:308
auto encoded_positional_parameters(std::vector< codec::binary > parameters) -> query_options &
Set list of positional parameters for a query.
Definition query_options.hxx:530
auto scan_cap(std::uint64_t scan_cap) -> query_options &
Supports customizing the maximum buffered channel size between the indexer and the query service.
Definition query_options.hxx:289
auto pipeline_batch(std::uint64_t pipeline_batch) -> query_options &
Supports customizing the number of items execution operators can batch for fetch from the KV layer on...
Definition query_options.hxx:330
auto readonly(bool readonly) -> query_options &
Allows explicitly marking a query as being readonly and not mutating and documents on the server side...
Definition query_options.hxx:203
auto use_replica(bool use_replica) -> query_options &
Specifies that the query engine should use replica nodes for KV fetches if the active node is down.
Definition query_options.hxx:253
auto adhoc(bool adhoc) -> query_options &
Allows turning this request into a prepared statement query.
Definition query_options.hxx:128
auto flex_index(bool flex_index) -> query_options &
Tells the query engine to use a flex index (utilizing the search service).
Definition query_options.hxx:218
auto consistent_with(const mutation_state &state) -> query_options &
Sets the mutation_tokens this query should be consistent with.
Definition query_options.hxx:426
auto scan_consistency(query_scan_consistency scan_consistency) -> query_options &
Customizes the consistency guarantees for this query.
Definition query_options.hxx:399
auto profile(query_profile profile) -> query_options &
Customizes the server profiling level for this query.
Definition query_options.hxx:170
auto positional_parameters(const Parameters &... parameters) -> query_options &
Set list of positional parameters for a query.
Definition query_options.hxx:465