Javascript Hyperledger Composer 中的文件

Javascript file in Hyperledger Composer

我是超级账本的初学者。我想从 Asset of Car 中检索所有数据,以便在 hyperledger composer 的 javascript 文件中做一些事情。我不需要一一输入资产汽车的ID。我该怎么办?


型号

participant Car identified by participant id{
 o String id
 o String name
}

asset CarAsset identified by id{
 o String id
 o String type
}

transaction CarTransaction{
 --> UserAsset asset
 //what can i do in here?
}


交易

function carTransaction(tx){
 //what can i do in here?
}

如果你想要所有汽车的数据,你可以写一个查询并在交易函数中使用它

query.qry

query select Cars {
  description: "Select all cars"
  statement:
      SELECT <your namespace>.Car
}

看看这个查询tutorial它可能会有帮助