hyperledger-fabrichyperledgeribm-blockchainibp-vscode-extension

How to apply a pagination on IBM vs code chaincode for fabric?


I'm using an IBM-Blockchain platform VS code extension for one of my POC development. I want pagination on the Query function in fabric. Here is my demo example:

let queryString = 
  { 
    "selector": {
      "isLink": isLink,
      "f_id":f_id
    }
  }

How can I put pagination (like when 5 data comes on the first page and then continue like another page) on this chaincode selector query which is created on the IBM-Blockchain platform? Can anyone help me?

Thanks.


Solution

  • pagination is done using a pagination api, so suggest you take a look here https://hyperledger.github.io/fabric-chaincode-node/release-1.4/api/fabric-shim.ChaincodeStub.html#getQueryResultWithPagination__anchor For the api reference. Sorry I don't know if there is any example of use of this in any of the fabric samples, if not then hopefully there are some examples in the test suite for fabric-chaincode-node on github.