Macro edgedb_protocol::named_args

source ยท
macro_rules! named_args {
    ($($key:expr => $value:expr,)+) => { ... };
    ($($key:expr => $value:expr),*) => { ... };
}
Expand description

Constructs named query arguments that implement QueryArgs so they can be passed into any query method.

use edgedb_protocol::value::Value;

let query = "SELECT (<str>$my_str, <int64>$my_int)";
let args = edgedb_protocol::named_args! {
    "my_str" => "Hello world!".to_string(),
    "my_int" => Value::Int64(42),
};

The value side of an argument must be impl Into<ValueOpt>. The type of the returned object is HashMap<&str, ValueOpt>.