Replies: 1 comment
-
This let res: Vec<surrealdb::sql::Value> = db.select("user").await?; simply needs to be let res = db.select(Resource::from("user")).await?; In
Yes, You can do a similar thing for raw queries as well. let value: Value = result.take(0)?; so async fn select_everyting(db: &Surreal<Db>) -> surrealdb::Result<()> {
let mut response = db.query("SELECT * from messages").await?;
let messages: Value = response.take(0)?;
println!("{messages}");
Ok(())
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Something along the line:
This one gives me an error:
serde_json
has aValue
type for this to be used when deserializng from JSON without defining a struct to accept the data.Full example
Result:
How could I make the
select_everyting
work without using theMessage
struct?Beta Was this translation helpful? Give feedback.
All reactions