mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-23 04:40:49 +01:00
Implemented GobDecoder and GobEncoder.
This commit is contained in:
parent
3b7679240e
commit
0ffa05d918
1 changed files with 10 additions and 0 deletions
10
decimal.go
10
decimal.go
|
@ -532,6 +532,16 @@ func (d Decimal) MarshalText() (text []byte, err error) {
|
|||
return []byte(d.String()), nil
|
||||
}
|
||||
|
||||
// GobDecode implements the gob.GobDecoder interface for gob serialization.
|
||||
func (d *Decimal) GobDecode(data []byte) error {
|
||||
return d.UnmarshalText(data)
|
||||
}
|
||||
|
||||
// GobEncode implements the gob.GobEncoder interface for gob serialization.
|
||||
func (d Decimal) GobEncode() ([]byte, error) {
|
||||
return d.MarshalText()
|
||||
}
|
||||
|
||||
// NOTE: buggy, unintuitive, and DEPRECATED! Use StringFixed instead.
|
||||
// StringScaled first scales the decimal then calls .String() on it.
|
||||
func (d Decimal) StringScaled(exp int32) string {
|
||||
|
|
Loading…
Reference in a new issue