pub struct BaseService<T: BaseEntity> {
pub mapper: BaseMapper<T>,
}
Fields§
§mapper: BaseMapper<T>
Implementations§
Source§impl<T: for<'a> FromRow<'a, MySqlRow> + Send + Unpin + Debug + Serialize + BaseEntity> BaseService<T>
impl<T: for<'a> FromRow<'a, MySqlRow> + Send + Unpin + Debug + Serialize + BaseEntity> BaseService<T>
pub async fn get_by_id(self, id: u64) -> Result<Option<T>, Error>
pub async fn get_one(self, wrapper: String) -> Result<Option<T>, Error>
pub async fn all(self) -> Result<Vec<T>, Error>
pub async fn list(self, wrapper: String) -> Result<Vec<T>, Error>
pub async fn list_by_ids(self, ids: Vec<u64>) -> Result<Vec<T>, Error>
pub async fn list_by_map(self, wrapper: String) -> Result<Option<T>, Error>
pub async fn page( self, page: String, wrapper: String, ) -> Result<PageData<T>, Error>
pub async fn count(self, wrapper: String) -> Result<i64, Error>
pub async fn save(self, entity: T) -> Result<MySqlQueryResult, Error>
pub async fn save_batch( self, entity_vec: Vec<T>, ) -> Result<MySqlQueryResult, Error>
pub async fn update( self, entity: T, wrapper: String, ) -> Result<MySqlQueryResult, Error>
pub async fn update_by_id(self, entity: T) -> Result<MySqlQueryResult, Error>
pub async fn remove(self, wrapper: String) -> Result<MySqlQueryResult, Error>
pub async fn remove_by_id(self, id: u64) -> Result<MySqlQueryResult, Error>
pub async fn remove_by_ids( self, ids: Vec<u64>, ) -> Result<MySqlQueryResult, Error>
Trait Implementations§
Source§impl<T: Clone + BaseEntity> Clone for BaseService<T>
impl<T: Clone + BaseEntity> Clone for BaseService<T>
Source§fn clone(&self) -> BaseService<T>
fn clone(&self) -> BaseService<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<T> Freeze for BaseService<T>
impl<T> !RefUnwindSafe for BaseService<T>
impl<T> Send for BaseService<T>where
T: Send,
impl<T> Sync for BaseService<T>where
T: Sync,
impl<T> Unpin for BaseService<T>where
T: Unpin,
impl<T> !UnwindSafe for BaseService<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more