Skip to main content

PartialModelTrait

Trait PartialModelTrait 

Source
pub trait PartialModelTrait: FromQueryResult {
    // Required method
    fn select_cols<S>(select: S) -> S
       where S: SelectColumns;

    // Provided method
    fn select_cols_nested<S>(
        select: S,
        _prefix: Option<&str>,
        _alias: Option<&str>,
    ) -> S
       where S: SelectColumns { ... }
}
Expand description

A trait for a part of Model

Required Methods§

Source

fn select_cols<S>(select: S) -> S
where S: SelectColumns,

Select specific columns this [PartialModel] needs

If you are implementing this by hand, please make sure to read the hints in the documentation for select_cols_nested and ensure to implement both methods.

Provided Methods§

Source

fn select_cols_nested<S>( select: S, _prefix: Option<&str>, _alias: Option<&str>, ) -> S
where S: SelectColumns,

Used when nesting these structs into each other.

This will stop being a provided method in a future major release. Please implement this method manually when implementing this trait by hand, and ensure that your select_cols implementation is calling it with _prefix as None.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T> PartialModelTrait for Option<T>

Source§

fn select_cols<S>(select: S) -> S
where S: SelectColumns,

Source§

fn select_cols_nested<S>( select: S, prefix: Option<&str>, _alias: Option<&str>, ) -> S
where S: SelectColumns,

Implementors§