Google Cloud Spanner C++ Client 2.13.0
A C++ Client Library for Google Cloud Spanner
Loading...
Searching...
No Matches
client_options.h
1// Copyright 2020 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_CLIENT_OPTIONS_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_CLIENT_OPTIONS_H
17
18#include "google/cloud/spanner/query_options.h"
19#include "google/cloud/spanner/version.h"
20#include "google/cloud/options.h"
21
22namespace google {
23namespace cloud {
24namespace spanner {
25GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
26
27/**
28 * ClientOptions allows the caller to set a variety of options when
29 * constructing a `Client` instance.
30 */
31class ClientOptions {
32 public:
33 ClientOptions() = default;
34 ClientOptions(ClientOptions const&) = default;
35 ClientOptions& operator=(ClientOptions const&) = default;
36 ClientOptions(ClientOptions&&) = default;
38
39 /**
40 * Convert the `ClientOptions` to the new, recommended way to represent
41 * options of all varieties, `google::cloud::Options`.
42 */
43 explicit operator Options() const { return Options(query_options_); }
44
45 /// Returns the `QueryOptions`
46 QueryOptions const& query_options() const { return query_options_; }
47
48 /// Sets the `QueryOptions`
50 query_options_ = std::move(qo);
51 return *this;
52 }
53
54 friend bool operator==(ClientOptions const& a, ClientOptions const& b) {
55 return a.query_options_ == b.query_options_;
56 }
57
58 friend bool operator!=(ClientOptions const& a, ClientOptions const& b) {
59 return !(a == b);
60 }
61
62 private:
63 QueryOptions query_options_;
64};
65
66GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
67} // namespace spanner
68} // namespace cloud
69} // namespace google
70
71#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_CLIENT_OPTIONS_H
ClientOptions allows the caller to set a variety of options when constructing a Client instance.
Definition: client_options.h:31
operator Options() const
Convert the ClientOptions to the new, recommended way to represent options of all varieties,...
Definition: client_options.h:43
ClientOptions(ClientOptions &&)=default
ClientOptions & operator=(ClientOptions const &)=default
friend bool operator==(ClientOptions const &a, ClientOptions const &b)
Definition: client_options.h:54
QueryOptions const & query_options() const
Returns the QueryOptions
Definition: client_options.h:46
ClientOptions & operator=(ClientOptions &&)=default
ClientOptions & set_query_options(QueryOptions qo)
Sets the QueryOptions
Definition: client_options.h:49
friend bool operator!=(ClientOptions const &a, ClientOptions const &b)
Definition: client_options.h:58
ClientOptions(ClientOptions const &)=default
These QueryOptions allow users to configure features about how their SQL queries executes on the serv...
Definition: query_options.h:37
friend bool operator==(QueryOptions const &a, QueryOptions const &b)
Definition: query_options.h:109
QueryOptions & operator=(QueryOptions &&)=default
Contains all the Cloud Spanner C++ client types and functions.
Definition: backoff_policy.h:23