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

Function add_user

databases/postgres/src/main.rs:27–38  ·  view source on GitHub ↗
(
    user: web::Json<User>,
    ThinData(db_pool): web::ThinData<Pool>,
)

Source from the content-addressed store, hash-verified

25}
26
27pub async fn add_user(
28 user: web::Json<User>,
29 ThinData(db_pool): web::ThinData<Pool>,
30) -> Result<HttpResponse, Error> {
31 let user_info: User = user.into_inner();
32
33 let client: Client = db_pool.get().await.map_err(MyError::PoolError)?;
34
35 let new_user = db::add_user(&client, user_info).await?;
36
37 Ok(HttpResponse::Ok().json(new_user))
38}
39
40#[actix_web::main]
41async fn main() -> std::io::Result<()> {

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected