diesel-rs / diesel

A safe, extensible ORM and Query Builder for Rust
https://diesel.rs
Apache License 2.0
12.79k stars 1.08k forks source link

Better docs on query chaining #4222

Closed wowinter13 closed 2 months ago

wowinter13 commented 2 months ago

Closes #3574

wowinter13 commented 2 months ago

@weiznich What do you think – should I add a compile fail test for this case? (because it looks a bit excessive) smth like:

extern crate diesel;

use diesel::dsl::count_star;
use diesel::sql_types::{Integer, Nullable};
use diesel::*;

table! {
    users {
        id -> Integer,
        nullable_int_col -> Nullable<Integer>,
    }
}

fn main() {
    use self::users::dsl::*;

    let source = users.select((id, count_star())).group_by(users::uuid);
}

(just to have the copy of this exact issue: https://github.com/diesel-rs/diesel/issues/3574#issue-1646268507)

Or it would be enough just to have these two documentation notes?