MCPcopy Index your code
hub / github.com/uber/aresdb / parseUInt32

Method parseUInt32

query/expr/parser.go:71–84  ·  view source on GitHub ↗

parseUInt32 parses a string and returns a 32-bit unsigned integer literal.

()

Source from the content-addressed store, hash-verified

69
70// parseUInt32 parses a string and returns a 32-bit unsigned integer literal.
71func (p *Parser) parseUInt32() (uint32, error) {
72 tok, pos, lit := p.scanIgnoreWhitespace()
73 if tok != NUMBER {
74 return 0, newParseError(tokstr(tok, lit), []string{"number"}, pos)
75 }
76
77 // Convert string to unsigned 32-bit integer
78 n, err := strconv.ParseUint(lit, 10, 32)
79 if err != nil {
80 return 0, &ParseError{Message: err.Error(), Pos: pos}
81 }
82
83 return uint32(n), nil
84}
85
86// parseUInt64 parses a string and returns a 64-bit unsigned integer literal.
87func (p *Parser) parseUInt64() (uint64, error) {

Callers

nothing calls this directly

Calls 4

scanIgnoreWhitespaceMethod · 0.95
newParseErrorFunction · 0.85
tokstrFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected