The KeySet class is a regular type that represents a collection of Keys.
Users can construct a KeySet instance, then add Keys and ranges of Keys 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();
// 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"; }
// 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"; }
[[["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 2025-03-21 UTC."],[[["This webpage details the `KeySet` class within the Google Cloud Spanner C++ library, a regular type representing a collection of `Key`s."],["Users can create `KeySet` instances and add individual `Key`s or ranges of `Key`s to these sets, ensuring all keys within a `KeySet` have consistent value counts and types."],["The `KeySet::All()` function allows users to represent all keys, facilitating operations like deleting all entries in a table, as demonstrated in the provided example."],["The page provides documentation on the `KeySet` class constructors, operators, and key functions such as `AddKey()` and `AddRange()`."],["Multiple version references of `KeySet` are accessible, with the latest being version 2.37.0-rc, and the current version of the page as 2.26.0."]]],[]]