מחיקת שורות באמצעות mutate

מחיקת שורות באמצעות mutate.

דוגמת קוד

C++

מידע על התקנת ספריית הלקוח של Bigtable ושימוש בה מופיע במאמר ספריות הלקוח של Bigtable.

כדי לבצע אימות ב-Bigtable, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

namespace cbt = ::google::cloud::bigtable;
[](cbt::Table table, std::vector<std::string> const& keys) {
  cbt::BulkMutation mutation;
  for (auto const& row_key : keys) {
    mutation.emplace_back(
        cbt::SingleRowMutation(row_key, cbt::DeleteFromRow()));
  }
  std::vector<cbt::FailedMutation> failures =
      table.BulkApply(std::move(mutation));
  if (failures.empty()) {
    std::cout << "All rows successfully deleted\n";
    return;
  }
  std::cerr << "The following mutations failed:\n";
  for (auto const& f : failures) {
    std::cerr << "index[" << f.original_index() << "]=" << f.status() << "\n";
  }
}

המאמרים הבאים

כדי לחפש ולסנן דוגמאות קוד למוצרים אחרים של Google Cloud , אפשר להיעזר בGoogle Cloud דפדפן לדוגמה.