diff --git a/src/executor/insert.rs b/src/executor/insert.rs index f198826d..6117e782 100644 --- a/src/executor/insert.rs +++ b/src/executor/insert.rs @@ -2,7 +2,7 @@ use crate::{ error::*, ActiveModelTrait, ConnectionTrait, DbBackend, EntityTrait, Insert, IntoActiveModel, Iterable, PrimaryKeyTrait, SelectModel, SelectorRaw, Statement, TryFromU64, }; -use sea_query::{FromValueTuple, InsertStatement, IntoColumnRef, Returning, ValueTuple}; +use sea_query::{FromValueTuple, Iden, InsertStatement, IntoColumnRef, Returning, ValueTuple}; use std::{future::Future, marker::PhantomData}; /// Defines a structure to perform INSERT operations in an ActiveModel @@ -51,7 +51,7 @@ where Inserter::::new(self.primary_key, query).exec(db) } - /// Execute an insert operation and return the inserted model + /// Execute an insert operation and return the inserted model (use `RETURNING` syntax if database supported) pub fn exec_with_returning<'a, C>( self, db: &'a C, @@ -88,7 +88,7 @@ where exec_insert(self.primary_key, builder.build(&self.query), db) } - /// Execute an insert operation and return the inserted model + /// Execute an insert operation and return the inserted model (use `RETURNING` syntax if database supported) pub fn exec_with_returning<'a, C>( self, db: &'a C, @@ -115,7 +115,6 @@ where type ValueTypeOf = as PrimaryKeyTrait>::ValueType; let last_insert_id_opt = match db.get_database_backend() { DbBackend::Postgres => { - use crate::sea_query::Iden; let cols = PrimaryKey::::iter() .map(|col| col.to_string()) .collect::>(); diff --git a/src/executor/update.rs b/src/executor/update.rs index 0cd42903..c16d4644 100644 --- a/src/executor/update.rs +++ b/src/executor/update.rs @@ -113,7 +113,7 @@ where } } _ => { - // If we updating a row that does not exist, error will be thrown here. + // If we updating a row that does not exist then an error will be thrown here. Updater::new(query).check_record_exists().exec(db).await?; let primary_key_value = match model.get_primary_key_value() { Some(val) => FromValueTuple::from_value_tuple(val),