15 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_KEYS_H 16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_KEYS_H 20 #include <google/spanner/v1/keys.pb.h> 37 using Key = std::vector<Value>;
45 template <
typename... Ts>
47 return Key{
Value(std::forward<Ts>(ts))...};
73 enum class Bound { kClosed, kOpen };
90 Key const&
key() const& {
return key_; }
93 Key&&
key() && {
return std::move(key_); }
118 template <
typename... Ts>
120 return KeyBound(
MakeKey(std::forward<Ts>(ts)...), KeyBound::Bound::kClosed);
130 template <
typename... Ts>
132 return KeyBound(
MakeKey(std::forward<Ts>(ts)...), KeyBound::Bound::kOpen);
137 ::google::spanner::v1::KeySet ToProto(KeySet);
138 KeySet FromProto(::google::spanner::v1::KeySet);
168 ks.proto_.set_all(
true);
204 friend ::google::spanner::v1::KeySet internal::ToProto(
KeySet);
205 friend KeySet internal::FromProto(::google::spanner::v1::KeySet);
206 explicit KeySet(google::spanner::v1::KeySet proto)
207 : proto_(std::move(proto)) {}
209 google::spanner::v1::KeySet proto_;
217 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_KEYS_H KeyBound MakeKeyBoundClosed(Ts &&... ts)
Returns a "closed" KeyBound with a Key constructed from the given arguments.
Key MakeKey(Ts &&... ts)
Constructs a Key from the given arguments.
The Value class represents a type-safe, nullable Spanner value.
Bound bound() const
Returns the Bound.
KeyBound MakeKeyBoundOpen(Ts &&... ts)
Returns an "open" KeyBound with a Key constructed from the given arguments.
friend bool operator!=(KeySet const &a, KeySet const &b)
Key const & key() const &
Returns the Key.
KeyBound(Key key, Bound bound)
Constructs an instance with the given key and bound.
bool operator==(Backup const &a, Backup const &b)
The KeySet class is a regular type that represents a collection of Keys.
Bound
An enum indicating whether the Key is included (closed) or excluded (open).
Contains all the Cloud Spanner C++ client types and functions.
Key && key() &&
Returns the Key (by move).
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.
static KeySet All()
Returns a KeySet that represents the set of "All" keys for the index.
friend bool operator!=(KeyBound const &a, KeyBound const &b)
#define SPANNER_CLIENT_NS