mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-22 04:20:50 +01:00
For MessagePack Add github.com/tinylib/msgp
This commit is contained in:
parent
2ae6f298b8
commit
37706fc9ff
3 changed files with 38 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,6 +4,7 @@
|
|||
# IntelliJ
|
||||
.idea/
|
||||
*.iml
|
||||
*.sum
|
||||
|
||||
# VS code
|
||||
*.code-workspace
|
||||
|
|
35
decimal_gen.go
Normal file
35
decimal_gen.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package decimal
|
||||
|
||||
// Code generated by github.com/tinylib/msgp DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/tinylib/msgp/msgp"
|
||||
)
|
||||
|
||||
// MarshalMsg implements msgp.Marshaler
|
||||
func (z Decimal) MarshalMsg(b []byte) (o []byte, err error) {
|
||||
o = msgp.Require(b, z.Msgsize())
|
||||
o = msgp.AppendFloat64(o, z.InexactFloat64())
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalMsg implements msgp.Unmarshaler
|
||||
func (z *Decimal) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
||||
{
|
||||
var zb0001 float64
|
||||
zb0001, bts, err = msgp.ReadFloat64Bytes(bts)
|
||||
if err != nil {
|
||||
err = msgp.WrapError(err)
|
||||
return
|
||||
}
|
||||
(*z) = NewFromFloat(zb0001)
|
||||
}
|
||||
o = bts
|
||||
return
|
||||
}
|
||||
|
||||
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
||||
func (z Decimal) Msgsize() (s int) {
|
||||
s = msgp.Float64Size
|
||||
return
|
||||
}
|
2
go.mod
2
go.mod
|
@ -1,3 +1,5 @@
|
|||
module github.com/shopspring/decimal
|
||||
|
||||
go 1.13
|
||||
|
||||
require github.com/tinylib/msgp v1.1.6
|
||||
|
|
Loading…
Reference in a new issue