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

Method scanBytes

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

Source from the content-addressed store, hash-verified

582}
583
584func (a *Int32Array) scanBytes(src []byte) error {
585 elems, err := scanLinearArray(src, []byte{','}, "Int32Array")
586 if err != nil {
587 return err
588 }
589 if *a != nil && len(elems) == 0 {
590 *a = (*a)[:0]
591 } else {
592 b := make(Int32Array, len(elems))
593 for i, v := range elems {
594 x, err := strconv.ParseInt(string(v), 10, 32)
595 if err != nil {
596 return fmt.Errorf("pq: parsing array element index %d: %w", i, err)
597 }
598 b[i] = int32(x)
599 }
600 *a = b
601 }
602 return nil
603}
604
605// Value implements the driver.Valuer interface.
606func (a Int32Array) Value() (driver.Value, error) {

Callers 1

ScanMethod · 0.95

Calls 1

scanLinearArrayFunction · 0.85

Tested by

no test coverage detected