简体   繁体   中英

can i write complex queries in hyperledger composer

我必须从资产中检索特定属性,例如从employeetable中选择名称。是否可以在Hyperledger Composer中获取特定属性

Yes, here the official documentation

https://hyperledger.github.io/composer/unstable/reference/query-language

And the specific example

query findEmployee{
    description: "Select employee based on the name"
    statement:
        SELECT org.example.Employee
            WHERE (firstName == _$nameParam)
}

In composer rest server, you can use API with filter fields . Such as {"fields": ["name", "description"]"} It will return only those fields instead of full objects.

Reference: https://hyperledger.github.io/composer/latest/business-network/query It said only where is currently support, but fields can be used as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM