Send feedback
Class KeySet (2.32.0)
Stay organized with collections
Save and categorize content based on your preferences.
Version 2.32.0 keyboard_arrow_down
The KeySet
class is a regular type that represents a collection of Key
s.
Users can construct a KeySet
instance, then add Key
s and ranges of Key
s to the set. The caller is responsible for ensuring that all keys in a given KeySet
instance contain the same number and types of values.
Users may also optionally construct an instance that represents all keys with KeySet::All()
.
Example
auto delete_albums = spanner::DeleteMutationBuilder(
"Albums", spanner::KeySet()
.AddKey(spanner::MakeKey(2, 1))
.AddKey(spanner::MakeKey(2, 3)))
.Build();
Example
void DeleteAll(google::cloud::spanner::Client client) {
namespace spanner = ::google::cloud::spanner;
// Delete all the performances, venues, albums and singers.
auto commit = client.Commit(spanner::Mutations{
spanner::MakeDeleteMutation("Performances", spanner::KeySet::All()),
spanner::MakeDeleteMutation("Venues", spanner::KeySet::All()),
spanner::MakeDeleteMutation("Albums", spanner::KeySet::All()),
spanner::MakeDeleteMutation("Singers", spanner::KeySet::All()),
});
if (!commit) throw std::move(commit).status();
std::cout << "delete-all was successful\n";
}
Constructors
KeySet()
KeySet(KeySet const &)
Parameter
Name
Description
KeySet const &
KeySet(KeySet &&)
Parameter
Name
Description
KeySet &&
Operators
operator=(KeySet const &)
Parameter
Name
Description
KeySet const &
Returns
Type
Description
KeySet &
operator=(KeySet &&)
Parameter
Name
Description
KeySet &&
Returns
Type
Description
KeySet &
Functions
static All()
Returns a KeySet
that represents the set of "All" keys for the index.
Example
void DeleteAll(google::cloud::spanner::Client client) {
namespace spanner = ::google::cloud::spanner;
// Delete all the performances, venues, albums and singers.
auto commit = client.Commit(spanner::Mutations{
spanner::MakeDeleteMutation("Performances", spanner::KeySet::All()),
spanner::MakeDeleteMutation("Venues", spanner::KeySet::All()),
spanner::MakeDeleteMutation("Albums", spanner::KeySet::All()),
spanner::MakeDeleteMutation("Singers", spanner::KeySet::All()),
});
if (!commit) throw std::move(commit).status();
std::cout << "delete-all was successful\n";
}
Returns
Type
Description
KeySet
AddKey(Key)
Adds the given key
to the KeySet
.
Example
auto delete_albums = spanner::DeleteMutationBuilder(
"Albums", spanner::KeySet()
.AddKey(spanner::MakeKey(2, 1))
.AddKey(spanner::MakeKey(2, 3)))
.Build();
Parameter
Name
Description
key
Key
Returns
Type
Description
KeySet &
AddRange(KeyBound, KeyBound)
Adds a range of keys defined by the given KeyBound
s.
Example
auto delete_albums = spanner::DeleteMutationBuilder(
"Albums", spanner::KeySet()
.AddKey(spanner::MakeKey(2, 1))
.AddKey(spanner::MakeKey(2, 3)))
.Build();
Parameters
Name
Description
start
KeyBound
end
KeyBound
Returns
Type
Description
KeySet &
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-17 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-17 UTC."],[],[]]