Skip to content

Commit 9e72e21

Browse files
committed
include more detailed examples
1 parent ca352cc commit 9e72e21

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

doc/v3-migration-guide.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,52 @@ have been removed.
5656
Developers that read rows by directly constructing a `RowReader` object should
5757
instead construct a `Table` object and call `Table::ReadRows(...)`.
5858

59+
For example, code that used to look like this:
60+
61+
**Before:**
62+
63+
```cpp
64+
#include "google/cloud/bigtable/data_client.h"
65+
#include "google/cloud/bigtable/row_reader.h"
66+
#include "google/cloud/bigtable/table.h"
67+
68+
// ...
69+
70+
auto client = google::cloud::bigtable::MakeDataClient(
71+
"my-project", "my-instance", creds);
72+
auto reader = google::cloud::bigtable::RowReader(
73+
client, "my-table-id", google::cloud::bigtable::RowSet("r1", "r2"),
74+
google::cloud::bigtable::RowReader::NO_ROWS_LIMIT,
75+
google::cloud::bigtable::Filter::PassAllFilter(),
76+
/*...retry and backoff policies...*/);
77+
78+
for (auto& row : reader) {
79+
if (!row) throw std::move(row).status();
80+
// ...
81+
}
82+
```
83+
84+
Should be changed to this:
85+
86+
**After:**
87+
88+
```cpp
89+
#include "google/cloud/bigtable/table.h"
90+
91+
// ...
92+
93+
namespace cbt = google::cloud::bigtable;
94+
cbt::Table table(cbt::MakeDataConnection(),
95+
cbt::TableResource("my-project", "my-instance", "my-table-id"));
96+
97+
for (auto& row : table.ReadRows(
98+
cbt::RowSet("r1", "r2"),
99+
cbt::Filter::PassAllFilter())) {
100+
if (!row) throw std::move(row).status();
101+
// ...
102+
}
103+
```
104+
59105
</details>
60106
61107
### Pubsub

0 commit comments

Comments
 (0)