Options for cluster::analytics_query() and scope::analytics_query().
More...
#include <couchbase/analytics_options.hxx>
|
struct | built |
| Immutable value object representing consistent options. More...
|
|
Options for cluster::analytics_query() and scope::analytics_query().
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ build()
auto build |
( |
| ) |
const -> built
|
|
inline |
Validates options and returns them as an immutable value.
- Returns
- consistent options as an immutable value
- Exceptions
-
- Since
- 1.0.0
- Internal
- Internal interface
◆ client_context_id()
Supports providing a custom client context ID for this query.
If no client context ID is provided by the user, a UUID is generated and sent automatically so by default it is always possible to identify a query when debugging.
- Parameters
-
client_context_id | the client context ID |
- Returns
- this options builder for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ consistent_with()
◆ encoded_named_parameters()
Set map of named parameters for a query.
This function expects that all parameters encoded into pairs containing mapping names of the parameter to valid JSON values encoded as string.
- Note
- This function is low-level, and instead named_parameters() should be considered.
- Parameters
-
parameters | mapping of pairs, where each entry contains string with valid JSON value. |
- Returns
- this options builder for chaining purposes.
- Since
- 1.0.0
- Uncommitted
- Might be changed in the future, and eventually promoted to committed
◆ encoded_positional_parameters()
Set list of positional parameters for a query.
This function expects that all parameters encoded into byte strings containing valid JSON values.
- Note
- This function is low-level, and instead positional_parameters() should be considered.
- Parameters
-
parameters | vector of binaries, where each entry contains string with valid JSON value. |
- Returns
- this options builder for chaining purposes.
- Since
- 1.0.0
- Uncommitted
- Might be changed in the future, and eventually promoted to committed
◆ encoded_raw_options()
Set map of raw options for a query.
This function expects that all parameters encoded into pairs containing mapping names of the parameter to valid JSON values encoded as string.
- Note
- This function is low-level, and instead raw() should be considered.
- Parameters
-
options | mapping of pairs, where each entry contains string with valid JSON value. |
- Returns
- this options builder for chaining purposes.
- Since
- 1.0.0
- Uncommitted
- Might be changed in the future, and eventually promoted to committed
◆ named_parameters()
template<typename... Parameters>
Set list of named parameters for a query.
- Template Parameters
-
Parameters | types for the parameter pairs |
- Parameters
-
parameters | the sequence of name-value pairs. Each value will be encoded into JSON. |
- Returns
- this options builder for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ positional_parameters()
template<typename... Parameters>
Set list of positional parameters for a query.
- Template Parameters
-
Parameters | types for the parameters |
- Parameters
-
parameters | the sequence of positional parameters. Each entry will be encoded into JSON. |
- Returns
- this options builder for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ priority()
Allows to give certain requests higher priority than others.
- Parameters
-
prioritized | if set to true this query will be treated with a higher priority by the service. |
- Returns
- this options builder for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ raw()
template<typename Value >
- Template Parameters
-
- Parameters
-
- Returns
- this options builder for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ readonly()
Allows explicitly marking a query as being readonly and not mutating and documents on the server side.
In addition to providing some security in that you are not accidentally modifying data, setting this flag to true also helps the client to more proactively retry and re-dispatch a query since then it can be sure it is idempotent. As a result, if your query is readonly then it is a good idea to set this flag.
- Parameters
-
readonly | true if readonly should be set, false is the default and will use the server side default. |
- Returns
- this options builder for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ scan_consistency()
Customizes the consistency guarantees for this query.
Tuning the scan consistency allows to trade data "freshness" for latency and vice versa. By default analytics_scan_consistency::not_bounded
is used, which means that the server returns the data it has in the index right away. This is fast, but might not include the most recent mutations. If you want to include all the mutations up to the point of the query, use analytics_scan_consistency::request_plus
.
Note that you cannot use this method and consistent_with(const mutation_state&)
at the same time, since they are mutually exclusive. As a rule of thumb, if you only care to be consistent with the mutation you just wrote on the same thread/app, use consistent_with(const mutation_state&)
. If you need "global" scan consistency, use analytics_scan_consistency::request_plus
on this method.
- Parameters
-
scan_consistency | the index scan consistency to be used for this query |
- Returns
- this options builder for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ scan_wait()
Allows customizing how long the query engine is willing to wait until the index catches up to whatever scan consistency is asked for in this query.
- Note
- that if
analytics_scan_consistency::not_bounded
is used, this method doesn't do anything at all. If no value is provided to this method, the server default is used.
- Parameters
-
wait | the maximum duration the query engine is willing to wait before failing. |
- Returns
- this options builder for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
The documentation for this struct was generated from the following file: