MCPcopy Index your code
hub / github.com/aarondl/sqlboiler / scanBytes

Method scanBytes

types/array.go:514–539  ·  view source on GitHub ↗
(src []byte)

Source from the content-addressed store, hash-verified

512}
513
514func (a *BoolArray) scanBytes(src []byte) error {
515 elems, err := scanLinearArray(src, []byte{','}, "BoolArray")
516 if err != nil {
517 return err
518 }
519 if *a != nil && len(elems) == 0 {
520 *a = (*a)[:0]
521 } else {
522 b := make(BoolArray, len(elems))
523 for i, v := range elems {
524 if len(v) < 1 {
525 return fmt.Errorf("boil: could not parse boolean array index %d: invalid boolean %q", i, v)
526 }
527 switch v[:1][0] {
528 case 't', 'T':
529 b[i] = true
530 case 'f', 'F':
531 b[i] = false
532 default:
533 return fmt.Errorf("boil: could not parse boolean array index %d: invalid boolean %q", i, v)
534 }
535 }
536 *a = b
537 }
538 return nil
539}
540
541// Value implements the driver.Valuer interface.
542func (a BoolArray) Value() (driver.Value, error) {

Callers 1

ScanMethod · 0.95

Calls 1

scanLinearArrayFunction · 0.85

Tested by

no test coverage detected