Skip to content

Instantly share code, notes, and snippets.

@himani1
Last active Jun 20, 2017
Embed
What would you like to do?
func (t *SampleChaincode) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {
fmt.Println("query is running " + function)
// Handle different functions
if function == "dummy_query" { //read a variable
fmt.Println("hi there " + function) //error
return nil, nil;
}
fmt.Println("query did not find func: " + function) //error
return nil, errors.New("Received unknown function query: " + function)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment