刪除含有變異的資料列

使用變異刪除資料列。

程式碼範例

C++

如要瞭解如何安裝及使用 Bigtable 的用戶端程式庫,請參閱這篇文章

如要向 Bigtable 進行驗證,請設定應用程式預設憑證。 詳情請參閱「為本機開發環境設定驗證」。

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 範例瀏覽器