MCPcopy Create free account
hub / github.com/go-pg/pg / ReadNumber

Method ReadNumber

internal/parser/parser.go:116–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114}
115
116func (p *Parser) ReadNumber() int {
117 ind := len(p.b) - p.i
118 for i, c := range p.b[p.i:] {
119 if !isNum(c) {
120 ind = i
121 break
122 }
123 }
124 if ind == 0 {
125 return 0
126 }
127 n, err := strconv.Atoi(string(p.b[p.i : p.i+ind]))
128 if err != nil {
129 panic(err)
130 }
131 p.i += ind
132 return n
133}
134
135func isNum(c byte) bool {
136 return c >= '0' && c <= '9'

Callers

nothing calls this directly

Calls 1

isNumFunction · 0.85

Tested by

no test coverage detected