(self, db: &'a C)
| 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 |
nothing calls this directly
no test coverage detected