Skip to content
Snippets Groups Projects

ENH: Support FIND and COUNT queries

Merged Florian Spreckelsen requested to merge f-query into dev
1 unresolved thread
Files
5
@@ -208,7 +208,7 @@ private:
class MultiResultSet : public ResultSet {
public:
~MultiResultSet() = default;
explicit MultiResultSet(MultiTransactionResponse *response);
explicit MultiResultSet(std::vector<std::unique_ptr<Entity>> result_set);
[[nodiscard]] inline auto Size() const noexcept -> int override {
return this->entities.size();
}
@@ -357,6 +357,17 @@ public:
return *result_set;
}
/**
* Return the result of a count query
*
* Only meaningful if there was exactly one COUNT query executed in
* this transaction. In all other cases, the return value will be
* -1.
*/
[[nodiscard]] inline auto GetCountResult() const -> int {
return query_count;
}
/**
* Return the number of sub-requests in this transaction.
*
@@ -367,6 +378,23 @@ public:
return this->request->requests_size();
}
/**
* Get a JSON representation of the respone.
*
* For debugging.
*/
inline auto ResponseToString() const -> const std::string {
google::protobuf::util::JsonOptions options;
std::string out;
google::protobuf::util::MessageToJsonString(*this->response, &out, options);
return out;
}
/**
* Get a JSON representation of the request.
*
* For debugging.
*/
inline auto RequestToString() const -> const std::string {
google::protobuf::util::JsonOptions options;
std::string out;
@@ -383,6 +411,7 @@ private:
MultiTransactionRequest *request;
mutable MultiTransactionResponse *response;
std::string error_message;
mutable long query_count;
};
template <class InputIterator>
Loading