使用生锈柴油时,xxx 未实现“NonAggregate”特征
the trait `NonAggregate` is not implemented for xxx when using rust diesel
我使用以下命令从 postgresql 生成 shema:
diesel migration run
然后使用 cargo build 构建这个 rust 项目,显示如下错误:
280 | / table! {
281 | | rss_sub_source (id) {
282 | | id -> Int8,
283 | | sub_url -> Varchar,
... |
316 | | }
317 | | }
| |_^ the trait `SelectableExpression<rss_sub_source::table>` is not implemented for `(rss_sub_source::columns::id, rss_sub_source::columns::sub_url, rss_sub_source::columns::created_time, rss_sub_source::columns::updated_time, rss_sub_source::columns::sub_status, rss_sub_source::columns::rss_type, rss_sub_source::columns::standard_type, rss_sub_source::columns::standard_version, rss_sub_source::columns::cron, rss_sub_source::columns::trigger_count, rss_sub_source::columns::next_trigger_time, rss_sub_source::columns::sub_name, rss_sub_source::columns::last_trigger_time, rss_sub_source::columns::tags, rss_sub_source::columns::source_url, rss_sub_source::columns::sub_type, rss_sub_source::columns::intro, rss_sub_source::columns::remark, rss_sub_source::columns::title_hash, rss_sub_source::columns::failed_count, rss_sub_source::columns::lang, rss_sub_source::columns::frequency_month, rss_sub_source::columns::reputation, rss_sub_source::columns::rep_lastest_refresh_time, rss_sub_source::columns::scrapy_take_time, rss_sub_source::columns::follower, rss_sub_source::columns::censor_status, rss_sub_source::columns::etag, rss_sub_source::columns::last_modified, rss_sub_source::columns::editor_pick, rss_sub_source::columns::fav_icon_url, rss_sub_source::columns::dynamic_interval, rss_sub_source::columns::local_icon_url, rss_sub_source::columns::creator)`
|
note: required by a bound in `diesel::Table::AllColumns`
--> /Users/xiaoqiangjiang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/diesel-1.4.8/src/query_source/mod.rs:62:22
为什么会这样?我该怎么做才能解决它?这是 diesel 生成的 rust shema 代码 table:
table! {
rss_sub_source (id) {
id -> Int8,
sub_url -> Varchar,
created_time -> Int8,
updated_time -> Int8,
sub_status -> Int2,
rss_type -> Varchar,
standard_type -> Varchar,
standard_version -> Varchar,
cron -> Varchar,
trigger_count -> Int4,
next_trigger_time -> Nullable<Timestamp>,
sub_name -> Varchar,
last_trigger_time -> Nullable<Timestamptz>,
tags -> Nullable<Array<Int4>>,
source_url -> Nullable<Varchar>,
sub_type -> Nullable<Varchar>,
intro -> Nullable<Varchar>,
remark -> Nullable<Varchar>,
title_hash -> Nullable<Varchar>,
failed_count -> Int4,
lang -> Nullable<Varchar>,
frequency_month -> Nullable<Int4>,
reputation -> Nullable<Int4>,
rep_lastest_refresh_time -> Nullable<Int8>,
scrapy_take_time -> Nullable<Int4>,
follower -> Nullable<Int8>,
censor_status -> Nullable<Int4>,
etag -> Nullable<Varchar>,
last_modified -> Nullable<Varchar>,
editor_pick -> Nullable<Int4>,
fav_icon_url -> Nullable<Varchar>,
dynamic_interval -> Int4,
local_icon_url -> Nullable<Varchar>,
creator -> Int8,
}
}
我已经通过像这样配置柴油来启用大型 table:
diesel = { version = "1.4.7", features = ["postgres","32-column-tables"] }
但还是不行。
正如 table!
宏文档中明确说明的那样:
By default this allows a maximum of 32 columns per table. You can increase this limit to 64 by enabling the 64-column-tables feature. You can increase it to 128 by enabling the 128-column-tables feature. You can decrease it to 16 columns, which improves compilation time, by disabling the default features of Diesel. Note that enabling 64 column tables or larger will substantially increase the compile time of Diesel.
我计算了这个 table 的 34 列,所以仅仅启用 32-column-tables
并没有添加必要的特征实现。
我使用以下命令从 postgresql 生成 shema:
diesel migration run
然后使用 cargo build 构建这个 rust 项目,显示如下错误:
280 | / table! {
281 | | rss_sub_source (id) {
282 | | id -> Int8,
283 | | sub_url -> Varchar,
... |
316 | | }
317 | | }
| |_^ the trait `SelectableExpression<rss_sub_source::table>` is not implemented for `(rss_sub_source::columns::id, rss_sub_source::columns::sub_url, rss_sub_source::columns::created_time, rss_sub_source::columns::updated_time, rss_sub_source::columns::sub_status, rss_sub_source::columns::rss_type, rss_sub_source::columns::standard_type, rss_sub_source::columns::standard_version, rss_sub_source::columns::cron, rss_sub_source::columns::trigger_count, rss_sub_source::columns::next_trigger_time, rss_sub_source::columns::sub_name, rss_sub_source::columns::last_trigger_time, rss_sub_source::columns::tags, rss_sub_source::columns::source_url, rss_sub_source::columns::sub_type, rss_sub_source::columns::intro, rss_sub_source::columns::remark, rss_sub_source::columns::title_hash, rss_sub_source::columns::failed_count, rss_sub_source::columns::lang, rss_sub_source::columns::frequency_month, rss_sub_source::columns::reputation, rss_sub_source::columns::rep_lastest_refresh_time, rss_sub_source::columns::scrapy_take_time, rss_sub_source::columns::follower, rss_sub_source::columns::censor_status, rss_sub_source::columns::etag, rss_sub_source::columns::last_modified, rss_sub_source::columns::editor_pick, rss_sub_source::columns::fav_icon_url, rss_sub_source::columns::dynamic_interval, rss_sub_source::columns::local_icon_url, rss_sub_source::columns::creator)`
|
note: required by a bound in `diesel::Table::AllColumns`
--> /Users/xiaoqiangjiang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/diesel-1.4.8/src/query_source/mod.rs:62:22
为什么会这样?我该怎么做才能解决它?这是 diesel 生成的 rust shema 代码 table:
table! {
rss_sub_source (id) {
id -> Int8,
sub_url -> Varchar,
created_time -> Int8,
updated_time -> Int8,
sub_status -> Int2,
rss_type -> Varchar,
standard_type -> Varchar,
standard_version -> Varchar,
cron -> Varchar,
trigger_count -> Int4,
next_trigger_time -> Nullable<Timestamp>,
sub_name -> Varchar,
last_trigger_time -> Nullable<Timestamptz>,
tags -> Nullable<Array<Int4>>,
source_url -> Nullable<Varchar>,
sub_type -> Nullable<Varchar>,
intro -> Nullable<Varchar>,
remark -> Nullable<Varchar>,
title_hash -> Nullable<Varchar>,
failed_count -> Int4,
lang -> Nullable<Varchar>,
frequency_month -> Nullable<Int4>,
reputation -> Nullable<Int4>,
rep_lastest_refresh_time -> Nullable<Int8>,
scrapy_take_time -> Nullable<Int4>,
follower -> Nullable<Int8>,
censor_status -> Nullable<Int4>,
etag -> Nullable<Varchar>,
last_modified -> Nullable<Varchar>,
editor_pick -> Nullable<Int4>,
fav_icon_url -> Nullable<Varchar>,
dynamic_interval -> Int4,
local_icon_url -> Nullable<Varchar>,
creator -> Int8,
}
}
我已经通过像这样配置柴油来启用大型 table:
diesel = { version = "1.4.7", features = ["postgres","32-column-tables"] }
但还是不行。
正如 table!
宏文档中明确说明的那样:
By default this allows a maximum of 32 columns per table. You can increase this limit to 64 by enabling the 64-column-tables feature. You can increase it to 128 by enabling the 128-column-tables feature. You can decrease it to 16 columns, which improves compilation time, by disabling the default features of Diesel. Note that enabling 64 column tables or larger will substantially increase the compile time of Diesel.
我计算了这个 table 的 34 列,所以仅仅启用 32-column-tables
并没有添加必要的特征实现。