MarshalText implements the encoding.TextMarshaler interface.
()
| 798 | |
| 799 | // MarshalText implements the encoding.TextMarshaler interface. |
| 800 | func (d *Decimal) MarshalText() ([]byte, error) { |
| 801 | if d == nil { |
| 802 | return []byte("<nil>"), nil |
| 803 | } |
| 804 | return []byte(d.String()), nil |
| 805 | } |
| 806 | |
| 807 | // NullDecimal represents a string that may be null. NullDecimal implements |
| 808 | // the database/sql.Scanner interface so it can be used as a scan destination: |