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

Function parsePositiveAmount

11_app_dev/chaincode_example05.go:232–241  ·  view source on GitHub ↗
(value string)

Source from the content-addressed store, hash-verified

230}
231
232func parsePositiveAmount(value string) (int, error) {
233 amount, err := parseNonNegativeAmount(value)
234 if err != nil {
235 return 0, err
236 }
237 if amount == 0 {
238 return 0, fmt.Errorf("amount must be greater than zero")
239 }
240 return amount, nil
241}
242
243func parseNonNegativeAmount(value string) (int, error) {
244 amount, err := strconv.Atoi(value)

Callers 1

BuyByAddressMethod · 0.70

Calls 1

parseNonNegativeAmountFunction · 0.70

Tested by

no test coverage detected