userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
samples/ydb_service/views/bson-upserting/post/view.cpp
#include "view.hpp"
#include <
userver/ydb/component.hpp
>
#include <
userver/ydb/table.hpp
>
namespace
sample {
namespace
{
const
std::string kInsertQuery = R
"(
--!syntax_v1
DECLARE $id AS String;
DECLARE $doc AS String;
UPSERT INTO orders (id, doc)
VALUES ($id, $doc);
)";
}
// namespace
std::string BsonUpsertingHandler::HandleRequest(
server::http::HttpRequest
& request,
server::request::RequestContext
&)
const
{
const
auto
&
id
= request.
GetArg
(
"id"
);
const
auto
& body = request.
RequestBody
();
ydb_client_->ExecuteDataQuery(kInsertQuery,
"$id"
,
id
,
"$doc"
, body);
return
{};
}
}
// namespace sample
Generated on
for userver by
Doxygen
1.17.0