17 #include <google/protobuf/util/message_differencer.h> 18 #include <google/spanner/v1/keys.pb.h> 27 void AppendKey(google::protobuf::ListValue& lv,
Key&& key) {
29 *lv.add_values() = internal::ToProto(std::move(v)).second;
36 ::google::spanner::v1::KeySet ToProto(KeySet ks) {
37 return std::move(ks.proto_);
40 KeySet FromProto(::google::spanner::v1::KeySet proto) {
41 return KeySet(std::move(proto));
47 return a.key_ == b.key_ && a.bound_ == b.bound_;
51 if (proto_.all())
return *
this;
52 AppendKey(*proto_.add_keys(), std::move(key));
57 if (proto_.all())
return *
this;
58 auto* range = proto_.add_ranges();
59 auto* start_proto = start.
bound() == KeyBound::Bound::kClosed
60 ? range->mutable_start_closed()
61 : range->mutable_start_open();
62 AppendKey(*start_proto, std::move(start).key());
63 auto* end_proto = end.
bound() == KeyBound::Bound::kClosed
64 ? range->mutable_end_closed()
65 : range->mutable_end_open();
66 AppendKey(*end_proto, std::move(end).key());
71 google::protobuf::util::MessageDifferencer differencer;
72 return differencer.Compare(a.proto_, b.proto_);
Bound bound() const
Returns the Bound.
The KeySet class is a regular type that represents a collection of Keys.
bool operator==(KeySet const &a, KeySet const &b)
Contains all the Cloud Spanner C++ client types and functions.
std::vector< Value > Key
A Key is a collection of Value objects where the i'th value corresponds to the i'th component of the ...
The KeyBound class is a regular type that represents an open or closed endpoint for a range of keys.
#define SPANNER_CLIENT_NS