MCPcopy
hub / github.com/CodisLabs/codis / ArgumentInteger

Function ArgumentInteger

pkg/utils/args.go:35–44  ·  view source on GitHub ↗
(d map[string]interface{}, name string)

Source from the content-addressed store, hash-verified

33}
34
35func ArgumentInteger(d map[string]interface{}, name string) (int, bool) {
36 if s, ok := Argument(d, name); ok {
37 n, err := strconv.Atoi(s)
38 if err != nil {
39 log.PanicErrorf(err, "option %s isn't a valid integer", name)
40 }
41 return n, true
42 }
43 return 0, false
44}
45
46func ArgumentIntegerMust(d map[string]interface{}, name string) int {
47 n, ok := ArgumentInteger(d, name)

Callers 1

ArgumentIntegerMustFunction · 0.85

Calls 2

ArgumentFunction · 0.85
PanicErrorfMethod · 0.80

Tested by

no test coverage detected