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

Method Value

types/array.go:844–871  ·  view source on GitHub ↗

Value implements the driver.Valuer interface.

()

Source from the content-addressed store, hash-verified

842
843// Value implements the driver.Valuer interface.
844func (a GenericArray) Value() (driver.Value, error) {
845 if a.A == nil {
846 return nil, nil
847 }
848
849 rv := reflect.ValueOf(a.A)
850
851 switch rv.Kind() {
852 case reflect.Slice:
853 if rv.IsNil() {
854 return nil, nil
855 }
856 case reflect.Array:
857 default:
858 return nil, fmt.Errorf("boil: Unable to convert %T to array", a.A)
859 }
860
861 if n := rv.Len(); n > 0 {
862 // There will be at least two curly brackets, N bytes of values,
863 // and N-1 bytes of delimiters.
864 b := make([]byte, 0, 1+2*n)
865
866 b, _, err := appendArray(b, rv, n)
867 return string(b), err
868 }
869
870 return "{}", nil
871}
872
873// Int64Array represents a one-dimensional array of the PostgreSQL integer types.
874type Int64Array []int64

Calls 2

appendArrayFunction · 0.85
LenMethod · 0.45