MCPcopy Index your code
hub / github.com/lib/pq / scanBytes

Method scanBytes

array.go:168–186  ·  view source on GitHub ↗
(src []byte)

Source from the content-addressed store, hash-verified

166}
167
168func (a *ByteaArray) scanBytes(src []byte) error {
169 elems, err := scanLinearArray(src, []byte{','}, "ByteaArray")
170 if err != nil {
171 return err
172 }
173 if *a != nil && len(elems) == 0 {
174 *a = (*a)[:0]
175 } else {
176 b := make(ByteaArray, len(elems))
177 for i, v := range elems {
178 b[i], err = parseBytea(v)
179 if err != nil {
180 return fmt.Errorf("could not parse bytea array index %d: %w", i, err)
181 }
182 }
183 *a = b
184 }
185 return nil
186}
187
188// Value implements the driver.Valuer interface. It uses the "hex" format which
189// is only supported on PostgreSQL 9.0 or newer.

Callers 1

ScanMethod · 0.95

Calls 2

scanLinearArrayFunction · 0.85
parseByteaFunction · 0.85

Tested by

no test coverage detected