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

Method one

src/query/delete.rs:63–76  ·  view source on GitHub ↗

Delete one Model or ActiveModel Model ``` use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend}; assert_eq!( Delete::one(cake::Model { id: 1, name: "Apple Pie".to_owned(), }) .build(DbBackend::Postgres) .to_string(), r#"DELETE FROM "cake" WHERE "cake"."id" = 1"#, ); ``` ActiveModel ``` use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend}; assert_eq!( Delete::one(cake::ActiveM

(model: M)

Source from the content-addressed store, hash-verified

61 /// );
62 /// ```
63 pub fn one<E, A, M>(model: M) -> DeleteOne<A>
64 where
65 E: EntityTrait,
66 A: ActiveModelTrait<Entity = E>,
67 M: IntoActiveModel<A>,
68 {
69 let myself = DeleteOne {
70 query: DeleteStatement::new()
71 .from_table(A::Entity::default().table_ref())
72 .to_owned(),
73 model: model.into_active_model(),
74 };
75 myself.prepare()
76 }
77
78 /// Delete many ActiveModel
79 ///

Callers

nothing calls this directly

Calls 4

table_refMethod · 0.80
into_active_modelMethod · 0.80
prepareMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected