// ===== Example: Pagination with Ad hoc Rich Query ========================================================
// queryAuthSceneWithPagination uses a query string, page size and a bookmark to perform a query
// for marbles. Query string matching state database syntax is passed in and executed as is.
// The number of fetched records would be equal to or lesser than the specified page size.
// Supports ad hoc queries that can be defined at runtime by the client.
// If this is not desired, follow the queryMarblesForOwner example for parameterized queries.
// Only available on state databases that support rich query (e.g. CouchDB)
// Paginated queries are only valid for read only transactions.
// =========================================================================================
Pagination with Ad hoc Rich Query
queryAuthSceneWithPagination uses a query string, page size and a bookmark to perform a query
for marbles. Query string matching state database syntax is passed in and executed as is.
The number of fetched records would be equal to or lesser than the specified page size.
Supports ad hoc queries that can be defined at runtime by the client.
If this is not desired, follow the queryMarblesForOwner example for parameterized queries.
Only available on state databases that support rich query
Paginated queries are only valid for read only transactions.
// ===== Example : Pagination with Ad hoc Rich Query ======================================================== // queryAuthSceneWithPagination uses a query string page size and a bookmark to perform a query // for marbles . Query string matching state database syntax is passed in and executed as is . // The number of fetched records would be equal to or lesser than the specified page size . // Supports ad hoc queries that can be defined at runtime by the client . // If this is not desired follow the queryMarblesForOwner example for parameterized queries . // Only available on state databases that support rich query ( e . g . CouchDB ) // Paginated queries are only valid for read only transactions . // =========================================================================================
func (t *AuthChaincode) queryAuthSceneWithPagination(stub shim.ChaincodeStubInterface, args []string) pb.Response {
        if len(args) < 3 {
                return shim.Error("Incorrect number of arguments. Expecting 3")
        }
        queryString := args[0]
        pageSize, err := strconv.ParseInt(args[1], 10, 32)
        if err != nil {
                return shim.Error(err.Error())
        }
        bookmark := args[2]
        queryResults, err := getQueryResultForQueryStringWithPagination(stub, queryString, int32(pageSize), bookmark)
        if err != nil {
                return shim.Error(err.Error())
        }
        return shim.Success(queryResults)
}
func ( t * AuthChaincode ) queryAuthSceneWithPagination ( stub shim . ChaincodeStubInterface , args [ ] string ) pb . Response { if len ( args ) < 3 { return shim . Error ( " " ) } queryString := args [ 0 ] pageSize , err := strconv . ParseInt ( args [ 1 ] , 10 , 32 ) if err != nil { return shim . Error ( err . Error ( ) ) } bookmark := args [ 2 ] queryResults , err := getQueryResultForQueryStringWithPagination ( stub , queryString , int32 ( pageSize ) , bookmark ) if err != nil { return shim . Error ( err . Error ( ) ) } return shim . Success ( queryResults ) }
Pagination with Ad hoc Rich Query
queryAuthSceneWithPagination uses a query string, page size and a bookmark to perform a query
for marbles.
Pagination with Ad hoc Rich Query queryAuthSceneWithPagination uses a query string page size and a bookmark to perform a query for marbles .
//   0 // "queryString" //return type of ParseInt is int64