The Invoke() function, as its name implies, is executed when an application wants to invoke a specific function in the Chaincode. The calling application will pass the particular function name to be executed, with the needed arguments. In our code we will define the following Invoke() function:
func (t *FoodContract) Invoke(stub shim.ChaincodeStubInterface) pb.Response { function, args := stub.GetFunctionAndParameters() if function == "createRawFood" { return t.createRawFood(stub, args) } else if function == "manufactureProcessing" { return t.manufactureProcessing(stub, args) } else if function == "wholesalerDistribute" { return t.wholesalerDistribute(stub, args) } else if function == "initiateShipment" { return ...