Trait diesel::dsl::OnlyDsl

source ·
pub trait OnlyDsl: Table {
    // Provided method
    fn only(self) -> Only<Self> { ... }
Available on crate feature postgres_backend only.
Expand description

The only method

This is only implemented for the Postgres backend. The ONLY clause is used to select only from one table and not any inherited ones.

Calling this function on a table (mytable.only()) will result in the SQL ONLY mytable. mytable.only() can be used just like any table in diesel since it implements Table.


let n_sers_in_main_table = users::table

Selects the number of entries in the users table excluding any rows found in inherited tables.

It can also be used in inner joins:

    .select((users::name, posts::title))
    .load::<(String, String)>(connection);

That query excludes any posts that reside in any inherited table.

Provided Methods§


fn only(self) -> Only<Self>

See the trait-level docs.

Object Safety§

This trait is not object safe.



impl<T: Table> OnlyDsl for T