Google Cloud Spanner C++ Client
A C++ Client Library for Google Cloud Spanner
instance.cc
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 
16 #include <array>
17 
18 namespace google {
19 namespace cloud {
20 namespace spanner {
21 inline namespace SPANNER_CLIENT_NS {
22 
23 Instance::Instance(std::string project_id, std::string instance_id)
24  : project_id_(std::move(project_id)),
25  instance_id_(std::move(instance_id)) {}
26 
27 std::string Instance::FullName() const {
28  return "projects/" + project_id_ + "/instances/" + instance_id_;
29 }
30 
31 bool operator==(Instance const& a, Instance const& b) {
32  return a.project_id_ == b.project_id_ && a.instance_id_ == b.instance_id_;
33 }
34 
35 bool operator!=(Instance const& a, Instance const& b) { return !(a == b); }
36 
37 std::ostream& operator<<(std::ostream& os, Instance const& dn) {
38  return os << dn.FullName();
39 }
40 
41 } // namespace SPANNER_CLIENT_NS
42 } // namespace spanner
43 } // namespace cloud
44 } // namespace google
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
Contains all the Cloud Spanner C++ client types and functions.
#define SPANNER_CLIENT_NS
Definition: version.h:22
std::string FullName() const
Returns the fully qualified instance name as a string of the form: "projects/<project-id>/instances/<...
Definition: instance.cc:27
std::ostream & operator<<(std::ostream &os, Backup const &bn)
Definition: backup.cc:35