// ===== Example: Parameterized rich query =================================================
// queryAuthSceneByGrantorId queries for authInfo based on a passed in owner.
// This is an example of a parameterized query where the query logic is baked into the chaincode,
// and accepting a single query parameter (owner).
// Only available on state databases that support rich query (e.g. CouchDB)
// =========================================================================================
Parameterized rich query
queryAuthSceneByGrantorId queries for authInfo based on a passed in owner.
This is an example of a parameterized query where the query logic is baked into the chaincode,
and accepting a single query parameter (owner).
Only available on state databases that support rich query
// ===== Example : Parameterized rich query ================================================= // queryAuthSceneByGrantorId queries for authInfo based on a passed in owner . // This is an example of a parameterized query where the query logic is baked into the chaincode // and accepting a single query parameter ( owner ) . // Only available on state databases that support rich query ( e . g . CouchDB ) // =========================================================================================
func (t *AuthChaincode) queryAuthSceneByGrantorId(stub shim.ChaincodeStubInterface, args []string) pb.Response {
        if len(args) < 1 {
                return shim.Error("Incorrect number of arguments. Expecting 1")
        }
        grantorId := args[0]
        queryString := fmt.Sprintf("{\"selector\":{\"grantorId\":\"%s\"}}", grantorId)
        queryResults, err := getQueryResultForQueryString(stub, queryString)
        if err != nil {
                return shim.Error(err.Error())
        }
        return shim.Success(queryResults)
}
func ( t * AuthChaincode ) queryAuthSceneByGrantorId ( stub shim . ChaincodeStubInterface , args [ ] string ) pb . Response { if len ( args ) < 1 { return shim . Error ( " " ) } grantorId := args [ 0 ] queryString := fmt . Sprintf ( " \" \" \" \" \" \" " , grantorId ) queryResults , err := getQueryResultForQueryString ( stub , queryString ) if err != nil { return shim . Error ( err . Error ( ) ) } return shim . Success ( queryResults ) }
Parameterized rich query
queryAuthSceneByGrantorId queries for authInfo based on a passed in owner.
Parameterized rich query queryAuthSceneByGrantorId queries for authInfo based on a passed in owner .