Google Cloud Spanner C++ Client
A C++ Client Library for Google Cloud Spanner
query_options.h
Go to the documentation of this file.
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 // http://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_QUERY_OPTIONS_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_QUERY_OPTIONS_H
17 
19 #include "google/cloud/optional.h"
20 #include <string>
21 
22 namespace google {
23 namespace cloud {
24 namespace spanner {
25 inline namespace SPANNER_CLIENT_NS {
26 
31 class QueryOptions {
32  public:
33  QueryOptions() = default;
34  QueryOptions(QueryOptions const&) = default;
35  QueryOptions& operator=(QueryOptions const&) = default;
36  QueryOptions(QueryOptions&&) = default;
37  QueryOptions& operator=(QueryOptions&&) = default;
38 
40  optional<std::string> const& optimizer_version() const {
41  return optimizer_version_;
42  }
43 
49  QueryOptions& set_optimizer_version(optional<std::string> version) {
50  optimizer_version_ = std::move(version);
51  return *this;
52  }
53 
54  friend bool operator==(QueryOptions const& a, QueryOptions const& b) {
55  return a.optimizer_version_ == b.optimizer_version_;
56  }
57 
58  friend bool operator!=(QueryOptions const& a, QueryOptions const& b) {
59  return !(a == b);
60  }
61 
62  private:
63  optional<std::string> optimizer_version_;
64 };
65 
66 } // namespace SPANNER_CLIENT_NS
67 } // namespace spanner
68 } // namespace cloud
69 } // namespace google
70 
71 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_QUERY_OPTIONS_H
optional< std::string > const & optimizer_version() const
Returns the optimizer version.
Definition: query_options.h:40
friend bool operator!=(QueryOptions const &a, QueryOptions const &b)
Definition: query_options.h:58
friend bool operator==(QueryOptions const &a, QueryOptions const &b)
Definition: query_options.h:54
Contains all the Cloud Spanner C++ client types and functions.
These QueryOptions allow users to configure features about how their SQL queries executes on the serv...
Definition: query_options.h:31
#define SPANNER_CLIENT_NS
Definition: version.h:22
QueryOptions & set_optimizer_version(optional< std::string > version)
Sets the optimizerion version to the specified integer string.
Definition: query_options.h:49
int constexpr version()