如何在 Diesel 中编写 GROUP BY 或 HAVING 子句?

use*_*633 7 group-by having rust rust-diesel

我正在尝试将以下 SQL 查询转换为相应的 Rust Diesel 代码:

SELECT COUNT(*)
FROM BookStore
WHERE BookName IN ('Lord of the Rings', 'Hobbit')
GROUP BY StoreId
HAVING COUNT(DISTINCT BookName) = 2
Run Code Online (Sandbox Code Playgroud)

到目前为止我能够将其翻译为:

let bookNames = vec!["Lord of the Rings", "Hobbit"];

let subquery = bookStores::table
.select(count_star())
.filter(bookName.eq_any(bookNames));
Run Code Online (Sandbox Code Playgroud)

我相信这可以翻译为:

SELECT COUNT(*)
FROM BookStore
WHERE BookName IN ('Lord of the Rings', 'Hobbit')
Run Code Online (Sandbox Code Playgroud)

我无法找到GROUP BYHAVINGSQL 子句的任何 Diesel 等效项。Diesel 中是否存在这些条款?