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

Method scanBytes

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

Source from the content-addressed store, hash-verified

645}
646
647func (a *StringArray) scanBytes(src []byte) error {
648 elems, err := scanLinearArray(src, []byte{','}, "StringArray")
649 if err != nil {
650 return err
651 }
652 if *a != nil && len(elems) == 0 {
653 *a = (*a)[:0]
654 } else {
655 b := make(StringArray, len(elems))
656 for i, v := range elems {
657 if b[i] = string(v); v == nil {
658 return fmt.Errorf("pq: parsing array element index %d: cannot convert nil to string", i)
659 }
660 }
661 *a = b
662 }
663 return nil
664}
665
666// Value implements the driver.Valuer interface.
667func (a StringArray) Value() (driver.Value, error) {

Callers 1

ScanMethod · 0.95

Calls 1

scanLinearArrayFunction · 0.85

Tested by

no test coverage detected