Google Cloud Spanner C++ Client  1.32.1
A C++ Client Library for Google Cloud Spanner
Public Types | Public Member Functions | List of all members
google::cloud::spanner::v1::KeyBound Class Reference

The KeyBound class is a regular type that represents an open or closed endpoint for a range of keys. More...

#include <google/cloud/spanner/keys.h>

Public Types

enum class  Bound { kClosed , kOpen }
 An enum indicating whether the Key is included (closed) or excluded (open). More...
 

Public Member Functions

 KeyBound ()=delete
 Not default constructible. More...
 
 KeyBound (Key key, Bound bound)
 Constructs an instance with the given key and bound. More...
 
Key const & key () const &
 Returns the Key. More...
 
Key && key () &&
 Returns the Key (by move). More...
 
Bound bound () const
 Returns the Bound. More...
 
Copy and move semantics.
 KeyBound (KeyBound const &)=default
 
KeyBoundoperator= (KeyBound const &)=default
 
 KeyBound (KeyBound &&)=default
 
KeyBoundoperator= (KeyBound &&)=default
 

Friends

Equality.
bool operator== (KeyBound const &a, KeyBound const &b)
 
bool operator!= (KeyBound const &a, KeyBound const &b)
 

Detailed Description

The KeyBound class is a regular type that represents an open or closed endpoint for a range of keys.

A range of keys is defined by a starting KeyBound and an ending KeyBound, and it logically includes all intermediate keys, optionally including/excluding the bounds.

KeyBounds can be "open", meaning the matching row will be excluded from the results, or "closed" meaning the matching row will be included. KeyBound instances should be created with the MakeKeyBoundOpen() or MakeKeyBoundClosed() factory functions.

Example
The KeySet class is a regular type that represents a collection of Keys.
Definition: keys.h:157
KeySet & AddRange(KeyBound start, KeyBound end)
Adds a range of keys defined by the given KeyBounds.
Definition: keys.cc:43
KeyBound MakeKeyBoundOpen(Ts &&... ts)
Returns an "open" KeyBound with a Key constructed from the given arguments.
Definition: keys.h:136
Example
auto delete_singers_range =
"Singers", spanner::KeySet().AddRange(spanner::MakeKeyBoundClosed(3),
.Build();
KeyBound MakeKeyBoundClosed(Ts &&... ts)
Returns a "closed" KeyBound with a Key constructed from the given arguments.
Definition: keys.h:124
spanner_internal::DeleteMutationBuilder DeleteMutationBuilder
A helper class to construct "delete" mutations.
Definition: mutations.h:355

Definition at line 74 of file keys.h.

Member Enumeration Documentation

◆ Bound

An enum indicating whether the Key is included (closed) or excluded (open).

Enumerator
kClosed 
kOpen 

Definition at line 78 of file keys.h.

Constructor & Destructor Documentation

◆ KeyBound() [1/4]

google::cloud::spanner::v1::KeyBound::KeyBound ( )
delete

Not default constructible.

◆ KeyBound() [2/4]

google::cloud::spanner::v1::KeyBound::KeyBound ( Key  key,
Bound  bound 
)
inline

Constructs an instance with the given key and bound.

Definition at line 84 of file keys.h.

◆ KeyBound() [3/4]

google::cloud::spanner::v1::KeyBound::KeyBound ( KeyBound const &  )
default

◆ KeyBound() [4/4]

google::cloud::spanner::v1::KeyBound::KeyBound ( KeyBound &&  )
default

Member Function Documentation

◆ bound()

Bound google::cloud::spanner::v1::KeyBound::bound ( ) const
inline

Returns the Bound.

Definition at line 101 of file keys.h.

◆ key() [1/2]

Key&& google::cloud::spanner::v1::KeyBound::key ( ) &&
inline

Returns the Key (by move).

Definition at line 98 of file keys.h.

◆ key() [2/2]

Key const& google::cloud::spanner::v1::KeyBound::key ( ) const &
inline

Returns the Key.

Definition at line 95 of file keys.h.

◆ operator=() [1/2]

KeyBound& google::cloud::spanner::v1::KeyBound::operator= ( KeyBound &&  )
default

◆ operator=() [2/2]

KeyBound& google::cloud::spanner::v1::KeyBound::operator= ( KeyBound const &  )
default

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( KeyBound const &  a,
KeyBound const &  b 
)
friend

Definition at line 106 of file keys.h.

◆ operator==

bool operator== ( KeyBound const &  a,
KeyBound const &  b 
)
friend

Definition at line 33 of file keys.cc.