MCPcopy
hub / github.com/yeasy/blockchain_guide / parseIDAndAmount

Function parseIDAndAmount

11_app_dev/chaincode_example03.go:294–304  ·  view source on GitHub ↗
(id string, amount string)

Source from the content-addressed store, hash-verified

292}
293
294func parseIDAndAmount(id string, amount string) (int, int, error) {
295 parsedID, err := strconv.Atoi(id)
296 if err != nil {
297 return 0, 0, fmt.Errorf("id must be an integer: %w", err)
298 }
299 value, err := parsePositiveAmount(amount)
300 if err != nil {
301 return 0, 0, err
302 }
303 return parsedID, value, nil
304}
305
306func parsePositiveAmount(value string) (int, error) {
307 amount, err := strconv.Atoi(value)

Callers 3

IssueCoinToBankMethod · 0.85
IssueCoinToCompanyMethod · 0.85
TransferMethod · 0.85

Calls 1

parsePositiveAmountFunction · 0.70

Tested by

no test coverage detected