多個前置字串

讀取資料列索引鍵符合清單中任何前置字串的資料列。

程式碼範例

C++

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

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

namespace cbt = ::google::cloud::bigtable;
using ::google::cloud::StatusOr;
[](cbt::Table table, std::vector<std::string> const& prefix_list) {
  cbt::Filter filter = cbt::Filter::Latest(1);
  auto row_set = cbt::RowSet();
  for (auto const& prefix : prefix_list) {
    auto row_range_prefix = cbt::RowRange::Prefix(prefix);
    row_set.Append(row_range_prefix);
  }

  for (StatusOr<cbt::Row>& row : table.ReadRows(std::move(row_set), filter)) {
    if (!row) throw std::move(row).status();
    std::cout << row->row_key() << ":\n";
    for (cbt::Cell const& cell : row->cells()) {
      std::cout << "\t" << cell.family_name() << ":"
                << cell.column_qualifier() << "    @ "
                << cell.timestamp().count() << "us\n"
                << "\t\"" << cell.value() << '"' << "\n";
    }
  }
}

後續步驟

如要搜尋及篩選其他 Google Cloud 產品的程式碼範例,請參閱Google Cloud 範例瀏覽器