Replies: 1 comment
-
You need to cast result to Vec<serde_json::Value> or Option<serde_json::Value> for example. let articles: Vec<serde_json::Value> = DB.query("SELECT * FROM article LIMIT 25 FETCH revision").await.unwrap().take(0).unwrap();
let title = articles.first().unwrap().get("revision").unwrap().get("title").unwrap(); let article_option: Option<serde_json::Value> = DB.query("SELECT * FROM ONLY article LIMIT 1 FETCH revision").await.unwrap().take(0).unwrap();
let article = article_option.unwrap();
let title = article.get("revision").unwrap().get("title").unwrap(); |
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
-
iam using actix, in previous version (0.8) the result query as an array object, so i can direct response from query process
let res = dbs.process(parse(query.as_str()).unwrap(), &ses, None, false).await.unwrap(); Ok(HttpResponse::Ok().json(res))
how to get result as array object in version 0.9 ?
let res = DB.query("select * from account").await.unwrap();
so i can directly result of the query as an result json like this
let res = DB.query("select * from account").await.unwrap(); Ok(HttpResponse::Ok().json(res))
Beta Was this translation helpful? Give feedback.
All reactions