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

Method delete_post

examples/poem_example/service/src/mutation.rs:40–48  ·  view source on GitHub ↗
(db: &DbConn, id: i32)

Source from the content-addressed store, hash-verified

38 }
39
40 pub async fn delete_post(db: &DbConn, id: i32) -> Result<DeleteResult, DbErr> {
41 let post: post::ActiveModel = Post::find_by_id(id)
42 .one(db)
43 .await?
44 .ok_or(DbErr::Custom("Cannot find post.".to_owned()))
45 .map(Into::into)?;
46
47 post.delete(db).await
48 }
49
50 pub async fn delete_all_posts(db: &DbConn) -> Result<DeleteResult, DbErr> {
51 Post::delete_many().exec(db).await

Callers

nothing calls this directly

Calls 2

oneMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected