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

Method exec

src/executor/insert.rs:49–63  ·  view source on GitHub ↗
(self, db: &'a C)

Source from the content-addressed store, hash-verified

47 /// Execute an insert operation
48 #[allow(unused_mut)]
49 pub async fn exec<'a, C>(self, db: &'a C) -> Result<TryInsertResult<InsertResult<A>>, DbErr>
50 where
51 C: ConnectionTrait,
52 A: 'a,
53 {
54 if self.insert_struct.columns.is_empty() {
55 return Ok(TryInsertResult::Empty);
56 }
57 let res = self.insert_struct.exec(db).await;
58 match res {
59 Ok(res) => Ok(TryInsertResult::Inserted(res)),
60 Err(DbErr::RecordNotInserted) => Ok(TryInsertResult::Conflicted),
61 Err(err) => Err(err),
62 }
63 }
64
65 /// Execute an insert operation without returning (don't use `RETURNING` syntax)
66 /// Number of rows affected is returned

Callers

nothing calls this directly

Calls 7

exec_insertFunction · 0.85
exprsMethod · 0.80
into_returning_exprMethod · 0.80
newFunction · 0.50
support_returningMethod · 0.45
get_database_backendMethod · 0.45
select_asMethod · 0.45

Tested by

no test coverage detected