MCPcopy Create free account
hub / github.com/brimdata/super / parseSlice

Function parseSlice

cmd/super/dev/dig/slice/command.go:93–107  ·  view source on GitHub ↗
(s string, end int64)

Source from the content-addressed store, hash-verified

91}
92
93func parseSlice(s string, end int64) (int, int, error) {
94 vals := strings.Split(s, ":")
95 if len(vals) != 2 {
96 return 0, 0, errors.New("slice syntax in first argument is from:to")
97 }
98 from, err := strconv.Atoi(vals[0])
99 if err != nil {
100 return 0, 0, fmt.Errorf("slice value is not a number: %q", vals[0])
101 }
102 to, err := strconv.Atoi(vals[1])
103 if err != nil {
104 return 0, 0, fmt.Errorf("slice value is not a number: %q", vals[1])
105 }
106 return from, to, nil
107}

Callers 1

RunMethod · 0.85

Calls 2

SplitMethod · 0.80
NewMethod · 0.80

Tested by

no test coverage detected