mysql - 使用 MySQL 的 Rust Actix-Web 示例项目 - Arity > 12 项
问题描述
我是 Rust 的新手,正在使用使用 Juniper 和 MySQL 的 Actix-Web“高级”GraphiQL 示例。当我的模型达到 13 列时,我遇到了一个问题,它会引发错误。这一直有效,直到我添加第 13 列。
#[graphql(description = "List of all (View) Items LIKE")]
fn items_view_like(context: &Context, item_number: String) -> FieldResult<Vec<ItemView>> {
let mut conn = context.dbpool.get().unwrap();
let items_view = conn
.prep_exec("select item_number, description, extended_description, item_type, bulk_type, item_product_group, billing_category, stock_unit, price_unit, purchasing_unit, manufacturing_unit, purchase_price, category from v_items WHERE item_number LIKE :item_number", params! {"item_number" => item_number})
.map(|result| {
result
.map(|x| x.unwrap())
.map(|row| {
let (item_number, description, extended_description, item_type, bulk_type, item_product_group, billing_category, stock_unit, price_unit, purchasing_unit, manufacturing_unit, purchase_price, category) = from_row(row);
ItemView {
item_number,
description,
extended_description,
item_type,
bulk_type,
item_product_group,
billing_category,
stock_unit,
price_unit,
purchasing_unit,
manufacturing_unit,
purchase_price,
category
}
})
.collect()
})
.unwrap();
Ok(items_view)
}
错误:
error[E0277]: the trait bound `(_, _, _, _, _, _, _, _, _, _, _, _, _): FromValue` is not satisfied
--> src\schemas\root.rs:116:227
|
116 | ...price, category) = from_row(row);
| ^^^^^^^^ the trait `FromValue` is not implemented for `(_, _, _, _, _, _, _, _, _, _, _, _, _)`
从我能够找到的情况来看,如果 from_row 方法有 12 列,那么我处理更大查询的正确方法是什么?
对此菜鸟的任何帮助将不胜感激。再次感谢。
解决方案
推荐阅读
- python - 如何在访问语料库中的文件时修复 FileNotFoundError
- sql - 在 R 中的 SQL 脚本中使用的 R readline 提示
- django - Django Localization:如果嵌入了链接,我们如何正确翻译字符串?
- javascript - 在动态附加 Id 时得到插值 ({{}})
- c# - 如何动态加载 xunit 测试?
- java - 如何在 Kotlin 中实现时间调度器
- java - arrayListOf(), sortedWith, compareBy Java 等价物
- html - 使用 VBA 从亚马逊获取产品价格和名称
- java - hibernate.hbm2ddl.auto 影响当前数据库
- c# - 在 MySql bool 和 C# bool 之间转换的正确方法是什么?