Scan implements the database/sql.Scanner interface. It supports string, []byte, int64, float64.
(src interface{})
| 772 | // Scan implements the database/sql.Scanner interface. It supports string, |
| 773 | // []byte, int64, float64. |
| 774 | func (d *Decimal) Scan(src interface{}) error { |
| 775 | switch src := src.(type) { |
| 776 | case []byte: |
| 777 | _, _, err := d.SetString(string(src)) |
| 778 | return err |
| 779 | case string: |
| 780 | _, _, err := d.SetString(src) |
| 781 | return err |
| 782 | case int64: |
| 783 | d.SetInt64(src) |
| 784 | return nil |
| 785 | case float64: |
| 786 | _, err := d.SetFloat64(src) |
| 787 | return err |
| 788 | default: |
| 789 | return fmt.Errorf("could not convert %T to Decimal", src) |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | // UnmarshalText implements the encoding.TextUnmarshaler interface. |
| 794 | func (d *Decimal) UnmarshalText(b []byte) error { |
no test coverage detected