For MessagePack Add github.com/tinylib/msgp

This commit is contained in:
13981712066 2021-10-15 14:11:52 +08:00
parent 2ae6f298b8
commit 37706fc9ff
3 changed files with 38 additions and 0 deletions

1
.gitignore vendored
View file

@ -4,6 +4,7 @@
# IntelliJ # IntelliJ
.idea/ .idea/
*.iml *.iml
*.sum
# VS code # VS code
*.code-workspace *.code-workspace

35
decimal_gen.go Normal file
View 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
View file

@ -1,3 +1,5 @@
module github.com/shopspring/decimal module github.com/shopspring/decimal
go 1.13 go 1.13
require github.com/tinylib/msgp v1.1.6