mutate で行を削除する

mutate を使用して行を削除します。

コードサンプル

C++

Bigtable 用のクライアント ライブラリをインストールして使用する方法については、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 のサンプルをご覧ください。