Skip to content

Commit e4eae92

Browse files
committed
impl(spanner): remove MakeTestRow which was been deprecated
1 parent d0db317 commit e4eae92

File tree

3 files changed

+15
-53
lines changed

3 files changed

+15
-53
lines changed

google/cloud/spanner/mocks/row.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "google/cloud/spanner/row.h"
1919
#include "google/cloud/spanner/value.h"
2020
#include "google/cloud/version.h"
21+
#include <memory>
2122
#include <string>
2223
#include <utility>
2324
#include <vector>
@@ -27,9 +28,6 @@ namespace cloud {
2728
namespace spanner_mocks {
2829
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
2930

30-
// TODO(#9086): Delete this when the MakeRow() implementation is moved here.
31-
#include "google/cloud/internal/disable_deprecation_warnings.inc"
32-
3331
/**
3432
* Creates a `spanner::Row` with the specified column names and values.
3533
*
@@ -41,7 +39,14 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
4139
*/
4240
inline spanner::Row MakeRow(
4341
std::vector<std::pair<std::string, spanner::Value>> pairs) {
44-
return spanner::MakeTestRow(std::move(pairs));
42+
auto values = std::vector<spanner::Value>{};
43+
auto columns = std::make_shared<std::vector<std::string>>();
44+
for (auto& p : pairs) {
45+
values.emplace_back(std::move(p.second));
46+
columns->emplace_back(std::move(p.first));
47+
}
48+
return spanner_internal::RowFriend::MakeRow(std::move(values),
49+
std::move(columns));
4550
}
4651

4752
/**
@@ -58,12 +63,14 @@ inline spanner::Row MakeRow(
5863
*/
5964
template <typename... Ts>
6065
spanner::Row MakeRow(Ts&&... ts) {
61-
return spanner::MakeTestRow(std::forward<Ts>(ts)...);
66+
auto columns = std::make_shared<std::vector<std::string>>();
67+
for (std::size_t i = 0; i < sizeof...(ts); ++i) {
68+
columns->emplace_back(std::to_string(i));
69+
}
70+
std::vector<spanner::Value> v{spanner::Value(std::forward<Ts>(ts))...};
71+
return spanner_internal::RowFriend::MakeRow(std::move(v), std::move(columns));
6272
}
6373

64-
// TODO(#9086): Delete this when the MakeRow() implementation is moved here.
65-
#include "google/cloud/internal/diagnostics_pop.inc"
66-
6774
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
6875
} // namespace spanner_mocks
6976
} // namespace cloud

google/cloud/spanner/row.cc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
3535

3636
namespace spanner {
3737
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
38-
Row MakeTestRow(std::vector<std::pair<std::string, Value>> pairs) {
39-
auto values = std::vector<Value>{};
40-
auto columns = std::make_shared<std::vector<std::string>>();
41-
for (auto& p : pairs) {
42-
values.emplace_back(std::move(p.second));
43-
columns->emplace_back(std::move(p.first));
44-
}
45-
return spanner_internal::RowFriend::MakeRow(std::move(values),
46-
std::move(columns));
47-
}
4838

4939
Row::Row() : Row({}, std::make_shared<std::vector<std::string>>()) {}
5040

google/cloud/spanner/row.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -200,41 +200,6 @@ class Row {
200200
std::shared_ptr<std::vector<std::string> const> columns_;
201201
};
202202

203-
/**
204-
* Creates a `Row` with the specified column names and values.
205-
*
206-
* This overload accepts a vector of pairs, allowing the caller to specify both
207-
* the column names and the `Value` that goes in each column.
208-
*
209-
* This function is intended for application developers who are mocking the
210-
* results of a `Client::ExecuteQuery` call.
211-
*/
212-
GOOGLE_CLOUD_CPP_SPANNER_MAKE_TEST_ROW_DEPRECATED()
213-
Row MakeTestRow(std::vector<std::pair<std::string, Value>> pairs);
214-
215-
/**
216-
* Creates a `Row` with `Value`s created from the given arguments and with
217-
* auto-generated column names.
218-
*
219-
* This overload accepts a variadic list of arguments that will be used to
220-
* create the `Value`s in the row. The column names will be implicitly
221-
* generated, the first column being "0", the second "1", and so on,
222-
* corresponding to the argument's position.
223-
*
224-
* This function is intended for application developers who are mocking the
225-
* results of a `Client::ExecuteQuery` call.
226-
*/
227-
template <typename... Ts>
228-
GOOGLE_CLOUD_CPP_SPANNER_MAKE_TEST_ROW_DEPRECATED()
229-
Row MakeTestRow(Ts&&... ts) {
230-
auto columns = std::make_shared<std::vector<std::string>>();
231-
for (std::size_t i = 0; i < sizeof...(ts); ++i) {
232-
columns->emplace_back(std::to_string(i));
233-
}
234-
std::vector<Value> v{Value(std::forward<Ts>(ts))...};
235-
return spanner_internal::RowFriend::MakeRow(std::move(v), std::move(columns));
236-
}
237-
238203
/**
239204
* A `RowStreamIterator` is an _Input Iterator_ (see below) that returns a
240205
* sequence of `StatusOr<Row>` objects.

0 commit comments

Comments
 (0)