hyperledger-fabric - Hyperledger Composer 查询处理器函数返回一个空白数组
问题描述
我正在尝试在 Hyperledger Composer 中编写查询处理器函数。但是,它只是返回一个空数组'[]',我不知道为什么。从 'org.land.Deal' 发出 GET 请求时。我有 2 件物品被退回。但是从查询处理器函数中,只返回空白数组。
这是交易功能:
/**
* Get Live Deals
* @param {org.land.GetLiveDeals} getLiveDeals - the transaction
* @transaction
*/
async function getLiveDeals(){
const liveDeals = [];
const dealRegistry = await getAssetRegistry('org.land.Deal');
const allDeals = await assetRegistry.getAll();
for(const deal of allDeals){
liveDeals.push(deal);
}
return liveDeals;
}
这是交易模型:
@commit(false)
@returns(Deal[])
transaction GetLiveDeals {
}
解决方案
推荐阅读
- ruby - 无法在 MacOS 10.14.2 Mojave 上使用 RVM 安装任何 Ruby:运行“__rvm_make -j4”时出错
- typescript - 如何声明泛型类泛型?
- python - 为什么会引发 asyncio.TimeoutError?
- java - 通过 BeanIO 在 XML 文件中生成 Header 字段
- php - 如何修复:在 myaccount/order.php 页面中显示日期
- python - 列表的 Python 字典到匹配索引的单个项目的字典
- javascript - ejs / node.js 中的字符串连接错误
- salesforce - 如何在文档中动态放置签名docusign标签
- python-3.x - 有没有办法改变指示seaborn箱线图中平均值的颜色和形状?
- vba - VBA,从指定列中清除#N/A