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

Method one

src/query/insert.rs:75–80  ·  view source on GitHub ↗

Insert one Model or ActiveModel Model ``` use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend}; assert_eq!( Insert::one(cake::Model { id: 1, name: "Apple Pie".to_owned(), }) .build(DbBackend::Postgres) .to_string(), r#"INSERT INTO "cake" ("id", "name") VALUES (1, 'Apple Pie')"#, ); ``` ActiveModel ``` use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend}; assert_eq!( Insert::

(m: M)

Source from the content-addressed store, hash-verified

73 /// );
74 /// ```
75 pub fn one<M>(m: M) -> Self
76 where
77 M: IntoActiveModel<A>,
78 {
79 Self::new().add(m)
80 }
81
82 /// Insert many Model or ActiveModel
83 ///

Callers

nothing calls this directly

Calls 2

addMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected