Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

as_guery() should not be needed to pass a table to exists #1650

Open
alatiera opened this issue Apr 20, 2018 · 0 comments
Open

as_guery() should not be needed to pass a table to exists #1650

alatiera opened this issue Apr 20, 2018 · 0 comments

Comments

@alatiera
Copy link
Contributor

alatiera commented Apr 20, 2018

Compiler Errors unless the method .as_query() on foo::table is used.

pub fn is_episodes_populated() -> Result<bool, Error> {
    use schema::episode::dsl::*;

    let db = connection();
    // Using r2d2
    let con = db.get()?;

    select(exists(episode))
        .get_result(&con)
        .map_err(From::from)
}

Error: https://paste.gnome.org/prsogzgak

Changing the select to select(exists(episode.as_query())) works, but @sgrif said
that ideally the explicit .as_query() should not be required.

select(exists(episode.as_query()))
    .get_result(&con)
    .map_err(From::from)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant