mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-28 00:00:20 +02:00
examples: Use diesel HasQuery trait (#3519)
This commit is contained in:
@@ -35,7 +35,7 @@ table! {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize, Selectable, Queryable)]
|
||||
#[derive(serde::Serialize, HasQuery)]
|
||||
struct User {
|
||||
id: i32,
|
||||
name: String,
|
||||
@@ -112,7 +112,7 @@ async fn list_users(
|
||||
) -> Result<Json<Vec<User>>, (StatusCode, String)> {
|
||||
let conn = pool.get().await.map_err(internal_error)?;
|
||||
let res = conn
|
||||
.interact(|conn| users::table.select(User::as_select()).load(conn))
|
||||
.interact(|conn| User::query().load(conn))
|
||||
.await
|
||||
.map_err(internal_error)?
|
||||
.map_err(internal_error)?;
|
||||
|
||||
Reference in New Issue
Block a user