Open AdrienPensart opened 1 year ago
The problem with using HashMap
is that arguments can be of different types. So dynamic typing should be used. I.e. edgedb_protocol::value::Value
type. Unforutately, we don't have a nice constructor for that at least yet.
The plan in, however, to make a derive:
#[derive(QueryArgs)]
struct Artist {
name: String,
}
But this is still on our todo list. For now, tuples are what is the easiest to use as query arguments.
Before edgedb-rust
offers a convenient way to construct named parameters from your struct, you can use named parameters with Client.query
by:
edgedb_protocol::value::Value::Object
from your map of Map<String, Value>
.Value::Object
to Client.query_xxx
To construct edgedb_protocol::value::Value::Object
from a map, you can reference https://github.com/edgedb/edgedb-rust/blob/releases/edgedb-protocol/v0.6.0/edgedb-protocol/src/value.rs#L100. Note that, the example is to build SparseObject
, we just learn it to build Value:Object
.
You can take a look at my examples:
https://github.com/edgedb/edgedb-rust/pull/304 should solve this
Hello!
Would it be possible to execute queries like this :