Google Cloud Bigtable C++ Client  1.1.0
A C++ Client Library for Google Cloud Bigtable
row_key.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_BIGTABLE_ROW_KEY_H_
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_ROW_KEY_H_
17 
18 #include "google/cloud/bigtable/internal/google_bytes_traits.h"
19 #include "google/cloud/bigtable/version.h"
20 #include <google/bigtable/v2/data.pb.h>
21 #include <type_traits>
22 #include <utility>
23 
24 namespace google {
25 namespace cloud {
26 namespace bigtable {
27 inline namespace BIGTABLE_CLIENT_NS {
28 /**
29  * Defines the type for row keys.
30  *
31  * Inside Google some protobuf fields of type `bytes` are mapped to a different
32  * type than `std::string`. This is the case for row keys. We use this type to
33  * automatically detect what is the representation for this field and use the
34  * correct mapping.
35  *
36  * External users of the Cloud Bigtable C++ client library should treat this as
37  * a complicated `typedef` for `std::string`. We have no plans to change the
38  * type in the external version of the C++ client library for the foreseeable
39  * future. In the eventuality that we do decide to change the type, this would
40  * be a reason update the library major version number, and we would give users
41  * time to migrate.
42  *
43  * In other words, external users of the Cloud Bigtable C++ client should simply
44  * write `std::string` where this type appears. For Google projects that must
45  * compile both inside and outside Google, this alias may be convenient.
46  */
47 using RowKeyType =
48  std::decay<decltype(std::declval<google::bigtable::v2::Row>().key())>::type;
49 
50 } // namespace BIGTABLE_CLIENT_NS
51 } // namespace bigtable
52 } // namespace cloud
53 } // namespace google
54 
55 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_ROW_KEY_H_
#define BIGTABLE_CLIENT_NS
Definition: version.h:22
Contains all the Cloud Bigtable C++ client APIs.