Open krist7599555 opened 3 years ago
Thanks for reporting this. I will look into it when I get some time.
this problem also hard to solve because we can not serialize json multiple time in rethinkdb
Yes, this is one of the reasons Command
doesn't currently implement Serialize
.
json!({
"id": r.uuid(), // error
"age": r.expr(16), // error
"created": r.now() // error
})
Is that the actual query you wanted to run or it's just an example? If it's the actual query you can work around this by using Uuid
from the uuid
crate instead of r.uuid()
, 16
instead of r.expr(16)
and constructing the time using DateTime instead of r.now()
.
I think the json serialization problem can be solved by implementing our own implementation of the json!
macro. You can see an example implementation in unreql crate
We could write something like this:
use unreql::{r, rjson};
r.table("users")
.get(1)
.update(rjson!({
"name": "John",
"upd_count": r.row().g("upd_count").add(1),
}))
can not using
reql::Command
inserde:json!
becauseserde::Serialize
behaviorthis problem also hard to solve because we can not serialize json multiple time in rethinkdb
i also try another approch like using
r.object([["key", "value"], ["key2", r.uuid()]])
andr.hashMap
is not implemented yet.any suggestion on this please.