Skip to main content

QueryBuilderWithMethods

Trait QueryBuilderWithMethods 

Source
pub trait QueryBuilderWithMethods<M> {
    // Required methods
    fn with(self, relation: &str) -> QueryBuilderWithEagerLoading<M>;
    fn with_where<F>(
        self,
        relation: &str,
        constraint: F,
    ) -> QueryBuilderWithEagerLoading<M>
       where F: FnOnce(RelationshipConstraintBuilder) -> RelationshipConstraintBuilder + 'static;
    fn with_when(
        self,
        condition: bool,
        relation: &str,
    ) -> QueryBuilderWithEagerLoading<M>;
    fn with_count(self, relation: &str) -> QueryBuilderWithEagerLoading<M>;
    fn with_count_where<F>(
        self,
        alias: &str,
        relation: &str,
        constraint: F,
    ) -> QueryBuilderWithEagerLoading<M>
       where F: FnOnce(RelationshipConstraintBuilder) -> RelationshipConstraintBuilder + 'static;
}
Expand description

Extension trait for QueryBuilder to add eager loading support

Required Methods§

Source

fn with(self, relation: &str) -> QueryBuilderWithEagerLoading<M>

Add a relationship to eagerly load

Source

fn with_where<F>( self, relation: &str, constraint: F, ) -> QueryBuilderWithEagerLoading<M>

Add a relationship with constraints

Source

fn with_when( self, condition: bool, relation: &str, ) -> QueryBuilderWithEagerLoading<M>

Add conditional eager loading

Source

fn with_count(self, relation: &str) -> QueryBuilderWithEagerLoading<M>

Load relationship counts without loading the relationships

Source

fn with_count_where<F>( self, alias: &str, relation: &str, constraint: F, ) -> QueryBuilderWithEagerLoading<M>

Load relationship counts with constraints

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<M> QueryBuilderWithMethods<M> for QueryBuilder<M>
where M: Model + Send + Sync,

Implementation for base QueryBuilder to support eager loading