MCPcopy Create free account
hub / github.com/uptrace/bun / newArrayParser

Function newArrayParser

dialect/pgdialect/array_parser.go:18–34  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

16}
17
18func newArrayParser(b []byte) *arrayParser {
19 p := new(arrayParser)
20
21 if b[0] == 'n' {
22 p.p.Reset(nil)
23 return p
24 }
25
26 if len(b) < 2 || (b[0] != '{' && b[0] != '[') || (b[len(b)-1] != '}' && b[len(b)-1] != ']') {
27 p.err = fmt.Errorf("pgdialect: can't parse array: %q", b)
28 return p
29 }
30 p.isJson = b[0] == '['
31
32 p.p.Reset(b[1 : len(b)-1])
33 return p
34}
35
36func (p *arrayParser) Next() bool {
37 if p.err != nil {

Callers 6

arrayScannerFunction · 0.85
decodeStringSliceFunction · 0.85
decodeIntSliceFunction · 0.85
decodeInt64SliceFunction · 0.85
scanFloat64SliceFunction · 0.85
TestArrayParserFunction · 0.85

Calls 1

ResetMethod · 0.45

Tested by 1

TestArrayParserFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…