Google Cloud Spanner C++ Client
A C++ Client Library for Google Cloud Spanner
database.h
Go to the documentation of this file.
1 // Copyright 2019 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_DATABASE_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_DATABASE_H
17 
20 #include <ostream>
21 #include <string>
22 #include <tuple>
23 
24 namespace google {
25 namespace cloud {
26 namespace spanner {
27 inline namespace SPANNER_CLIENT_NS {
28 
43 class Database {
44  public:
47  Database(Instance instance, std::string database_id);
48 
56  Database(std::string project_id, std::string instance_id,
57  std::string database_id);
58 
60 
61  Database(Database const&) = default;
62  Database& operator=(Database const&) = default;
63  Database(Database&&) = default;
64  Database& operator=(Database&&) = default;
66 
71  std::string FullName() const;
72 
74  Instance const& instance() const { return instance_; }
75  std::string const& database_id() const { return database_id_; }
76 
78 
79  friend bool operator==(Database const& a, Database const& b);
80  friend bool operator!=(Database const& a, Database const& b);
82 
84  friend std::ostream& operator<<(std::ostream& os, Database const& dn);
85 
86  private:
87  Instance instance_;
88  std::string database_id_;
89 };
90 
91 } // namespace SPANNER_CLIENT_NS
92 } // namespace spanner
93 } // namespace cloud
94 } // namespace google
95 
96 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_DATABASE_H
std::string const & database_id() const
Definition: database.h:75
bool operator!=(Backup const &a, Backup const &b)
Definition: backup.cc:33
This class identifies a Cloud Spanner Instance.
Definition: instance.h:41
bool operator==(Backup const &a, Backup const &b)
Definition: backup.cc:29
Instance const & instance() const
Returns the Instance containing this database.
Definition: database.h:74
Contains all the Cloud Spanner C++ client types and functions.
#define SPANNER_CLIENT_NS
Definition: version.h:22
This class identifies a Cloud Spanner Database.
Definition: database.h:43
std::ostream & operator<<(std::ostream &os, Backup const &bn)
Definition: backup.cc:35