You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For 'examples/databases'. I made some change on the sqlx.rs, I added an extra attuibutes to stored the times that the api viewed the data.
When I run the app, it gives me the following error message. Compiling databases v0.0.0 (C:\Users\kez\source\Rocket\examples\databases) error: failed to find data for query aae77e3480eb1af7c444f88d6e16c6c7ce58e806a17152500ff8c9528476853d at line 87 column 1 --> databases\src\sqlx.rs:31:5 | 31 | sqlx::query!("INSERT INTO posts (title, text, reviewedTimes) VALUES (?, ?, ?)", post.title, post.text, post.reviewedTimes) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in the macro $crate::sqlx_macros::expand_query` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile databases due to previous error`
And here is my code changed.
`struct Post {// struct edited, viewedTimes added
#[serde(skip_deserializing, skip_serializing_if = "Option::is_none")]
id: Option,
title: String,
text: String,
#[serde(skip_deserializing)]
viewedTimes: i64,
}
#[post("/post", data = "")]//use post to raise a new post
async fn create(mut db: Connection, post: Json) -> Result<Created<Json>> {
// There is no support for RETURNING.
sqlx::query!("INSERT INTO posts (title, text, reviewedTimes) VALUES (?, ?, ?)", post.title, post.text, post.reviewedTimes)//viewedTimes added
.execute(&mut *db)
.await?;
Ok(Created::new("/").body(post))
}
`
I can't find any cookbook for it. I am looking forward to the kind help from you guys, thanks :)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi guys, i am new to rust
For 'examples/databases'. I made some change on the sqlx.rs, I added an extra attuibutes to stored the times that the api viewed the data.
When I run the app, it gives me the following error message.
Compiling databases v0.0.0 (C:\Users\kez\source\Rocket\examples\databases) error: failed to find data for query aae77e3480eb1af7c444f88d6e16c6c7ce58e806a17152500ff8c9528476853d at line 87 column 1 --> databases\src\sqlx.rs:31:5 | 31 | sqlx::query!("INSERT INTO posts (title, text, reviewedTimes) VALUES (?, ?, ?)", post.title, post.text, post.reviewedTimes) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in the macro
$crate::sqlx_macros::expand_query` (in Nightly builds, run with -Z macro-backtrace for more info)error: could not compile
databases
due to previous error`And here is my code changed.
`struct Post {// struct edited, viewedTimes added
#[serde(skip_deserializing, skip_serializing_if = "Option::is_none")]
id: Option,
title: String,
text: String,
}
#[post("/post", data = "")]//use post to raise a new post
async fn create(mut db: Connection, post: Json) -> Result<Created<Json>> {
// There is no support for
RETURNING
.sqlx::query!("INSERT INTO posts (title, text, reviewedTimes) VALUES (?, ?, ?)", post.title, post.text, post.reviewedTimes)//viewedTimes added
.execute(&mut *db)
.await?;
}
`
I can't find any cookbook for it. I am looking forward to the kind help from you guys, thanks :)
Beta Was this translation helpful? Give feedback.
All reactions