| 197 | } |
| 198 | |
| 199 | func (s *scanPlanJSONToJSONUnmarshal) Scan(src []byte, dst any) error { |
| 200 | if src == nil { |
| 201 | dstValue := reflect.ValueOf(dst) |
| 202 | if dstValue.Kind() == reflect.Pointer { |
| 203 | el := dstValue.Elem() |
| 204 | switch el.Kind() { |
| 205 | case reflect.Pointer, reflect.Slice, reflect.Map, reflect.Interface: |
| 206 | el.Set(reflect.Zero(el.Type())) |
| 207 | return nil |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | return fmt.Errorf("cannot scan NULL into %T", dst) |
| 212 | } |
| 213 | |
| 214 | v := reflect.ValueOf(dst) |
| 215 | if v.Kind() != reflect.Pointer || v.IsNil() { |
| 216 | return fmt.Errorf("cannot scan into non-pointer or nil destinations %T", dst) |
| 217 | } |
| 218 | |
| 219 | elem := v.Elem() |
| 220 | elem.Set(reflect.Zero(elem.Type())) |
| 221 | |
| 222 | return s.unmarshal(src, dst) |
| 223 | } |
| 224 | |
| 225 | func (c *JSONCodec) DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error) { |
| 226 | if src == nil { |