1 Star 2 Fork 0

阿债/fiber-u8l

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
response_msgp.go 3.11 KB
一键复制 编辑 原始数据 按行查看 历史
阿债 提交于 2023-11-22 21:40 . 升级fiber
package idempotency
// Code generated by github.com/tinylib/msgp DO NOT EDIT.
import (
"github.com/tinylib/msgp/msgp"
)
// MarshalMsg implements msgp.Marshaler
func (z *response) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.Require(b, z.Msgsize())
// map header, size 3
// string "sc"
o = append(o, 0x83, 0xa2, 0x73, 0x63)
o = msgp.AppendInt(o, z.StatusCode)
// string "hs"
o = append(o, 0xa2, 0x68, 0x73)
o = msgp.AppendMapHeader(o, uint32(len(z.Headers)))
for za0001, za0002 := range z.Headers {
o = msgp.AppendString(o, za0001)
o = msgp.AppendArrayHeader(o, uint32(len(za0002)))
for za0003 := range za0002 {
o = msgp.AppendString(o, za0002[za0003])
}
}
// string "b"
o = append(o, 0xa1, 0x62)
o = msgp.AppendBytes(o, z.Body)
return
}
// UnmarshalMsg implements msgp.Unmarshaler
func (z *response) UnmarshalMsg(bts []byte) (o []byte, err error) {
var field []byte
_ = field
var zb0001 uint32
zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
if err != nil {
err = msgp.WrapError(err)
return
}
for zb0001 > 0 {
zb0001--
field, bts, err = msgp.ReadMapKeyZC(bts)
if err != nil {
err = msgp.WrapError(err)
return
}
switch msgp.UnsafeString(field) {
case "sc":
z.StatusCode, bts, err = msgp.ReadIntBytes(bts)
if err != nil {
err = msgp.WrapError(err, "StatusCode")
return
}
case "hs":
var zb0002 uint32
zb0002, bts, err = msgp.ReadMapHeaderBytes(bts)
if err != nil {
err = msgp.WrapError(err, "Headers")
return
}
if z.Headers == nil {
z.Headers = make(map[string][]string, zb0002)
} else if len(z.Headers) > 0 {
for key := range z.Headers {
delete(z.Headers, key)
}
}
for zb0002 > 0 {
var za0001 string
var za0002 []string
zb0002--
za0001, bts, err = msgp.ReadStringBytes(bts)
if err != nil {
err = msgp.WrapError(err, "Headers")
return
}
var zb0003 uint32
zb0003, bts, err = msgp.ReadArrayHeaderBytes(bts)
if err != nil {
err = msgp.WrapError(err, "Headers", za0001)
return
}
if cap(za0002) >= int(zb0003) {
za0002 = (za0002)[:zb0003]
} else {
za0002 = make([]string, zb0003)
}
for za0003 := range za0002 {
za0002[za0003], bts, err = msgp.ReadStringBytes(bts)
if err != nil {
err = msgp.WrapError(err, "Headers", za0001, za0003)
return
}
}
z.Headers[za0001] = za0002
}
case "b":
z.Body, bts, err = msgp.ReadBytesBytes(bts, z.Body)
if err != nil {
err = msgp.WrapError(err, "Body")
return
}
default:
bts, err = msgp.Skip(bts)
if err != nil {
err = msgp.WrapError(err)
return
}
}
}
o = bts
return
}
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *response) Msgsize() (s int) {
s = 1 + 3 + msgp.IntSize + 3 + msgp.MapHeaderSize
if z.Headers != nil {
for za0001, za0002 := range z.Headers {
_ = za0002
s += msgp.StringPrefixSize + len(za0001) + msgp.ArrayHeaderSize
for za0003 := range za0002 {
s += msgp.StringPrefixSize + len(za0002[za0003])
}
}
}
s += 2 + msgp.BytesPrefixSize + len(z.Body)
return
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/azhai/fiber-u8l.git
git@gitee.com:azhai/fiber-u8l.git
azhai
fiber-u8l
fiber-u8l
v2.51.0

搜索帮助