Membaca menurut kunci

Membaca menggunakan set kunci baris yang tidak berdekatan.

Contoh kode

C++

Untuk mempelajari cara menginstal dan menggunakan library klien untuk Bigtable, lihat library klien Bigtable.

Untuk melakukan autentikasi ke Bigtable, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

namespace cbt = ::google::cloud::bigtable;
using ::google::cloud::StatusOr;
[](cbt::Table table, std::vector<std::string> const& row_keys) {
  auto row_set = cbt::RowSet();

  for (auto const& row_key : row_keys) {
    row_set.Append(row_key);
  }

  cbt::Filter filter = cbt::Filter::Latest(1);
  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 (auto const& cell : row->cells()) {
      std::cout << "\t" << cell.family_name() << ":"
                << cell.column_qualifier() << "    @ "
                << cell.timestamp().count() << "us\n"
                << "\t\"" << cell.value() << '"' << "\n";
    }
  }
}

Langkah berikutnya

Untuk menelusuri dan memfilter contoh kode untuk produk Google Cloud lainnya, lihat Google Cloud browser contoh.