Attribute Macro request_query

Source
#[request_query]
Expand description

Extracts a specific request query parameter into a variable.

This attribute macro retrieves a specific request query parameter by key and makes it available as a variable. Query parameters are extracted from the URL request query string.

ยงUsage

use hyperlane::*;
use hyperlane_macros::*;

// For URL like "/search?q=rust&limit=10"
#[request_query("q" => search_term)]
async fn search(ctx: Context) {
    if let Some(term) = search_term {
        // Use the request query parameter
    }
}

The macro accepts a key-to-variable mapping in the format "key" => variable_name. The variable will be available as an Option<String> in the function scope.