Skip to main content

Linked

Trait Linked 

Source
pub trait Linked {
    type FromEntity: EntityTrait;
    type ToEntity: EntityTrait;

    // Required method
    fn link(&self) -> Vec<LinkDef> ;

    // Provided method
    fn find_linked(&self) -> Select<Self::ToEntity> { ... }
}
Expand description

A multi-hop traversal between two entities: a chain of LinkDef hops from FromEntity to ToEntity.

Use this when a single Related edge can’t express the path (for example, “user → post → comment → author”). Implement link to return the ordered list of hops; SeaORM joins them when ModelTrait::find_linked is called.

Required Associated Types§

Source

type FromEntity: EntityTrait

Entity at the start of the chain.

Source

type ToEntity: EntityTrait

Entity reached at the end of the chain.

Required Methods§

Ordered chain of hops from FromEntity to ToEntity.

Provided Methods§

Source

fn find_linked(&self) -> Select<Self::ToEntity>

Build a Select<ToEntity> that follows the chain.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§