Scan implements [sql.Scanner] interface to scan the provided value into the current FieldsList instance.
(value any)
| 368 | // Scan implements [sql.Scanner] interface to scan the provided value |
| 369 | // into the current FieldsList instance. |
| 370 | func (l *FieldsList) Scan(value any) error { |
| 371 | var data []byte |
| 372 | switch v := value.(type) { |
| 373 | case nil: |
| 374 | // no cast needed |
| 375 | case []byte: |
| 376 | data = v |
| 377 | case string: |
| 378 | data = []byte(v) |
| 379 | default: |
| 380 | return fmt.Errorf("failed to unmarshal FieldsList value %q", value) |
| 381 | } |
| 382 | |
| 383 | if len(data) == 0 { |
| 384 | data = []byte("[]") |
| 385 | } |
| 386 | |
| 387 | return l.UnmarshalJSON(data) |
| 388 | } |