Update sea-query dependency

This commit is contained in:
Chris Tsang 2021-05-19 17:42:57 +08:00
parent 690916f7bd
commit 70a1559c60
2 changed files with 6 additions and 10 deletions

View File

@ -25,7 +25,7 @@ path = "src/lib.rs"
[dependencies] [dependencies]
async-trait = "^0.1" async-trait = "^0.1"
futures = { version = "^0.3" } futures = { version = "^0.3" }
sea-query = { path = "../sea-query", version = "^0.10", features = [ "sqlx-mysql" ] } sea-query = { path = "../sea-query", version = "^0.11" }
sea-orm-macros = { path = "sea-orm-macros", optional = true } sea-orm-macros = { path = "sea-orm-macros", optional = true }
# sea-schema = { path = "../sea-schema" } # sea-schema = { path = "../sea-schema" }
serde = { version = "^1.0", features = [ "derive" ] } serde = { version = "^1.0", features = [ "derive" ] }

View File

@ -1,12 +1,8 @@
use crate::{ColumnTrait, Identity, IntoSimpleExpr, RelationDef}; use crate::{ColumnTrait, Identity, IntoSimpleExpr, RelationDef};
use sea_query::{Alias, ConditionWhere, Expr, SelectExpr, SelectStatement, SimpleExpr}; use sea_query::{Alias, Expr, SelectExpr, SelectStatement, SimpleExpr};
pub use sea_query::{JoinType, Order}; pub use sea_query::{Condition, JoinType, Order};
use std::rc::Rc; use std::rc::Rc;
pub mod condition {
pub use sea_query::{any, all};
}
pub trait QueryHelper: Sized { pub trait QueryHelper: Sized {
fn query(&mut self) -> &mut SelectStatement; fn query(&mut self) -> &mut SelectStatement;
@ -80,17 +76,17 @@ pub trait QueryHelper: Sized {
/// Add a condition tree. This can be called once only. /// Add a condition tree. This can be called once only.
/// ``` /// ```
/// use sea_orm::{condition, ColumnTrait, EntityTrait, QueryHelper, tests_cfg::cake, sea_query::MysqlQueryBuilder}; /// use sea_orm::{Condition, ColumnTrait, EntityTrait, QueryHelper, tests_cfg::cake, sea_query::MysqlQueryBuilder};
/// ///
/// assert_eq!( /// assert_eq!(
/// cake::Entity::find() /// cake::Entity::find()
/// .condition(condition::any().add(cake::Column::Id.eq(5))) /// .condition(Condition::any().add(cake::Column::Id.eq(5)))
/// .build(MysqlQueryBuilder) /// .build(MysqlQueryBuilder)
/// .to_string(), /// .to_string(),
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`id` = 5" /// "SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`id` = 5"
/// ); /// );
/// ``` /// ```
fn condition(mut self, cond: ConditionWhere) -> Self { fn condition(mut self, cond: Condition) -> Self {
self.query().cond_where(cond); self.query().cond_where(cond);
self self
} }