Skip to main content

IntoCondition

Trait IntoCondition 

Source
pub trait IntoCondition {
    // Required method
    fn into_condition(self) -> Condition;
}

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IntoCondition for RelationDef

Idiomatically generate the join condition.

This allows using RelationDef directly where sea_query expects an IntoCondition.

§Examples
use sea_orm::sea_query::*;
use sea_orm::tests_cfg::{cake, fruit};
use sea_orm::*;

let query = Query::select()
    .from(fruit::Entity)
    .inner_join(cake::Entity, fruit::Relation::Cake.def())
    .to_owned();

assert_eq!(
    query.to_string(MysqlQueryBuilder),
    r#"SELECT  FROM `fruit` INNER JOIN `cake` ON `fruit`.`cake_id` = `cake`.`id`"#
);
assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"SELECT  FROM "fruit" INNER JOIN "cake" ON "fruit"."cake_id" = "cake"."id""#
);
assert_eq!(
    query.to_string(SqliteQueryBuilder),
    r#"SELECT  FROM "fruit" INNER JOIN "cake" ON "fruit"."cake_id" = "cake"."id""#
);

Implementors§