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

Method scanBytes

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

Source from the content-addressed store, hash-verified

301}
302
303func (a *Float32Array) scanBytes(src []byte) error {
304 elems, err := scanLinearArray(src, []byte{','}, "Float32Array")
305 if err != nil {
306 return err
307 }
308 if *a != nil && len(elems) == 0 {
309 *a = (*a)[:0]
310 } else {
311 b := make(Float32Array, len(elems))
312 for i, v := range elems {
313 x, err := strconv.ParseFloat(string(v), 32)
314 if err != nil {
315 return fmt.Errorf("pq: parsing array element index %d: %w", i, err)
316 }
317 b[i] = float32(x)
318 }
319 *a = b
320 }
321 return nil
322}
323
324// Value implements the driver.Valuer interface.
325func (a Float32Array) Value() (driver.Value, error) {

Callers 1

ScanMethod · 0.95

Calls 1

scanLinearArrayFunction · 0.85

Tested by

no test coverage detected