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

Method ReadJSON

dialect/pgdialect/parser.go:109–143  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107}
108
109func (p *pgparser) ReadJSON() ([]byte, error) {
110 p.Unread()
111
112 c, err := p.ReadByte()
113 if err != nil {
114 return nil, err
115 }
116
117 p.buf = p.buf[:0]
118
119 depth := 0
120 for {
121 switch c {
122 case '{':
123 depth++
124 case '}':
125 depth--
126 }
127
128 p.buf = append(p.buf, c)
129
130 if depth == 0 {
131 break
132 }
133
134 next, err := p.ReadByte()
135 if err != nil {
136 return nil, err
137 }
138
139 c = next
140 }
141
142 return p.buf, nil
143}

Callers 1

readNextMethod · 0.80

Calls 2

UnreadMethod · 0.80
ReadByteMethod · 0.80

Tested by

no test coverage detected