MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / delete

Function delete

examples/rocket_okapi_example/api/src/okapi_example.rs:124–139  ·  view source on GitHub ↗
(conn: Connection<Db>, id: i32)

Source from the content-addressed store, hash-verified

122#[openapi(tag = "POST")]
123#[delete("/<id>")]
124async fn delete(conn: Connection<Db>, id: i32) -> R<Option<String>> {
125 let db = conn.into_inner();
126
127 let cmd = Mutation::delete_post(&db, id);
128 match cmd.await {
129 Ok(_) => Ok(Json(Some("Post successfully deleted.".to_string()))),
130 Err(e) => {
131 let m = error::Error {
132 err: "Error deleting post".to_string(),
133 msg: Some(e.to_string()),
134 http_status_code: 400,
135 };
136 Err(m)
137 }
138 }
139}
140
141/// # delete all posts
142#[openapi(tag = "POST")]

Callers

nothing calls this directly

Calls 2

delete_postFunction · 0.85
into_innerMethod · 0.80

Tested by

no test coverage detected