MCPcopy Create free account
hub / github.com/actix/examples / get_users

Function get_users

databases/postgres/src/main.rs:19–25  ·  view source on GitHub ↗
(ThinData(db_pool): web::ThinData<Pool>)

Source from the content-addressed store, hash-verified

17use self::{errors::MyError, models::User};
18
19pub async fn get_users(ThinData(db_pool): web::ThinData<Pool>) -> Result<HttpResponse, Error> {
20 let client: Client = db_pool.get().await.map_err(MyError::PoolError)?;
21
22 let users = db::get_users(&client).await?;
23
24 Ok(HttpResponse::Ok().json(users))
25}
26
27pub async fn add_user(
28 user: web::Json<User>,

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected