Request¶
#include <vgi_rpc/request.h>
Typed read-only view over an incoming RPC request batch. Wraps a single-row Arrow RecordBatch and its custom metadata.
Parameter Extraction¶
get<T>(name)¶
Extract a typed parameter by column name from row 0. Throws on missing column, null value, or type mismatch.
get_optional<T>(name)¶
Like get<T>() but returns std::nullopt when the column is missing or the value is null. Throws only on type mismatch.
Supported Types¶
| C++ Type | Arrow Type |
|---|---|
double |
float64 |
float |
float32 |
int64_t |
int64 |
int32_t |
int32 |
bool |
boolean |
std::string |
utf8 |
std::vector<uint8_t> |
binary |
std::vector<std::string> |
list<utf8> |
std::vector<int64_t> |
list<int64> |
std::vector<double> |
list<float64> |
Other Methods¶
method_name¶
The method name from request metadata.
request_id¶
The request ID from request metadata.
request_version¶
schema¶
The request batch schema.
batch¶
The underlying Arrow record batch.
metadata¶
The raw request metadata.
has_param¶
Check whether a column exists in the request batch.
get_column¶
Raw column accessor. Returns nullptr if column not found.
Example¶
auto handler = [](const vgi_rpc::Request& req, vgi_rpc::CallContext& ctx) {
// Required parameter
double value = req.get<double>("value");
// Optional parameter with default
auto scale = req.get_optional<double>("scale").value_or(1.0);
// Check existence
if (req.has_param("label")) {
std::string label = req.get<std::string>("label");
}
// ...
};