Skip to content

Commit

Permalink
Merge pull request #4351 from weiznich/fix/missing_type_def_for_count
Browse files Browse the repository at this point in the history
Add a missing type def
  • Loading branch information
weiznich authored Nov 19, 2024
2 parents 19c0405 + 665e9b8 commit 1a37a94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions diesel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ pub mod helper_types {
use super::query_dsl::methods::*;
use super::query_dsl::*;
use super::query_source::{aliasing, joins};
use crate::dsl::CountStar;
use crate::query_builder::select_clause::SelectClause;

#[doc(inline)]
Expand Down Expand Up @@ -699,6 +700,9 @@ pub mod helper_types {
/// [`DeleteStatement::returning`](crate::query_builder::DeleteStatement::returning)
pub type Returning<Q, S> =
<Q as crate::query_builder::returning_clause::ReturningClauseHelper<S>>::WithReturning;

#[doc(hidden)] // used for `QueryDsl::count`
pub type Count<Q> = Select<Q, CountStar>;
}

pub mod prelude {
Expand Down
5 changes: 5 additions & 0 deletions diesel_derives/tests/auto_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,11 @@ fn update_and_binary_operator_and_block() -> _ {
}))
}

#[auto_type]
fn count_query() -> _ {
users::table.count()
}

// #[auto_type]
// fn test_sql_fragment() -> _ {
// sql("foo")
Expand Down

0 comments on commit 1a37a94

Please sign in to comment.