15 #include "google/cloud/spanner/row.h"
16 #include "google/cloud/log.h"
17 #include "google/cloud/status.h"
18 #include "google/cloud/status_or.h"
25 namespace spanner_internal {
28 std::shared_ptr<std::vector<std::string>
const> columns) {
29 return spanner::
Row(std::move(values), std::move(columns));
37 auto values = std::vector<
Value>{};
38 auto columns = std::make_shared<std::vector<std::string>>();
39 for (
auto& p : pairs) {
40 values.emplace_back(std::move(p.second));
41 columns->emplace_back(std::move(p.first));
43 return spanner_internal::MakeRow(std::move(values), std::move(columns));
46 Row::
Row() :
Row({}, std::make_shared<std::vector<std::string>>()) {}
49 std::shared_ptr<
const std::vector<std::string>> columns)
50 : values_(std::move(values)), columns_(std::move(columns)) {
51 if (values_.size() != columns_->size()) {
52 GCP_LOG(FATAL) <<
"Row's value and column sizes do not match: "
53 << values_.size() <<
" vs " << columns_->size();
59 if (pos < values_.size())
return values_[pos];
65 auto it = std::find(columns_->begin(), columns_->end(), name);
66 if (it != columns_->end())
return get(std::distance(columns_->begin(), it)
);
71 return a.values_ == b.values_ && *a.columns_ == *b.columns_;
81 : row_
(Row{}), source_(std::move(source)) {
109 return !a.source_ == !b.source_;