Merge FromQueryResultExt into FromQueryResult
This commit is contained in:
parent
94b5fbf413
commit
2e1371537a
@ -28,20 +28,13 @@ pub trait ModelTrait: Clone + Send + Debug {
|
||||
}
|
||||
}
|
||||
|
||||
pub trait FromQueryResult {
|
||||
fn from_query_result(res: &QueryResult, pre: &str) -> Result<Self, DbErr>
|
||||
where
|
||||
Self: Sized;
|
||||
pub trait FromQueryResult: Sized {
|
||||
fn from_query_result(res: &QueryResult, pre: &str) -> Result<Self, DbErr>;
|
||||
|
||||
fn from_query_result_optional(res: &QueryResult, pre: &str) -> Result<Option<Self>, DbErr>
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
fn from_query_result_optional(res: &QueryResult, pre: &str) -> Result<Option<Self>, DbErr> {
|
||||
Ok(Self::from_query_result(res, pre).ok())
|
||||
}
|
||||
}
|
||||
|
||||
pub trait FromQueryResultExt: FromQueryResult + Sized {
|
||||
/// ```
|
||||
/// # #[cfg(feature = "mock")]
|
||||
/// # use sea_orm::{error::*, tests_cfg::*, MockDatabase, Transaction, DbBackend};
|
||||
@ -107,5 +100,3 @@ pub trait FromQueryResultExt: FromQueryResult + Sized {
|
||||
SelectorRaw::<SelectModel<Self>>::from_statement(stmt)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: FromQueryResult> FromQueryResultExt for T {}
|
||||
|
@ -2,9 +2,8 @@ pub use crate::{
|
||||
error::*, ActiveModelBehavior, ActiveModelTrait, ColumnDef, ColumnTrait, ColumnType,
|
||||
DeriveActiveModel, DeriveActiveModelBehavior, DeriveColumn, DeriveCustomColumn, DeriveEntity,
|
||||
DeriveEntityModel, DeriveModel, DerivePrimaryKey, DeriveRelation, EntityName, EntityTrait,
|
||||
EnumIter, ForeignKeyAction, FromQueryResultExt, Iden, IdenStatic, Linked, ModelTrait,
|
||||
PrimaryKeyToColumn, PrimaryKeyTrait, QueryFilter, QueryResult, Related, RelationDef,
|
||||
RelationTrait, Select, Value,
|
||||
EnumIter, ForeignKeyAction, Iden, IdenStatic, Linked, ModelTrait, PrimaryKeyToColumn,
|
||||
PrimaryKeyTrait, QueryFilter, QueryResult, Related, RelationDef, RelationTrait, Select, Value,
|
||||
};
|
||||
|
||||
#[cfg(feature = "with-json")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user