Skip to content

LinkDef with custom join condition #160

@tyt2y3

Description

@tyt2y3

Right now, LinkDef is simply an alias of RelationDef.
We can design a richer API for LinkDef that impl From<RelationDef>:

pub struct CakeToFilling;

impl Linked for CakeToFilling {
    type FromEntity = Entity;

    type ToEntity = super::filling::Entity;

    fn link(&self) -> Vec<LinkDef> {
        vec![
            super::cake_filling::Relation::Cake.def().rev().into()
                .and_on_condition(Expr::cust("a = b")),
            super::cake_filling::Relation::Filling.def().into(),
        ]
    }
}

This will open more flexibilities. Unfortunately it is a breaking change, thus has to wait until 0.3.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions