Advertisement
dimon-torchila

Untitled

May 11th, 2023
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. auto result = pg_cluster_->Execute(
  2. userver::storages::postgres::ClusterHostType::kMaster,
  3. "SELECT * FROM hello_schema.couriers"
  4. "WHERE $1 = courier_id", courier_id
  5. );
  6. userver::formats::json::ValueBuilder valueBuilder;
  7. for(const auto& row : result){
  8. userver::formats::json::ValueBuilder builder;
  9. builder["courier_id"] = row["courier_id"].As<int>();
  10. builder["courier_type"] = row["courier_type"];
  11. for(const auto& iterator : row["regions"]){
  12. builder["regions"].PushBack(std::move(iterator));
  13. }
  14. builder["regions"] = row["regions"];
  15. builder["working_hours"] = row["working_hours"];
  16. valueBuilder.PushBack(std::move(builder));
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement