本文整理匯總了Golang中github.com/tinylib/msgp/msgp.Reader.ReadUint32方法的典型用法代碼示例。如果您正苦於以下問題:Golang Reader.ReadUint32方法的具體用法?Golang Reader.ReadUint32怎麽用?Golang Reader.ReadUint32使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/tinylib/msgp/msgp.Reader
的用法示例。
在下文中一共展示了Reader.ReadUint32方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: DecodeMsg
// DecodeMsg implements msgp.Decodable
func (z *interval32) DecodeMsg(dc *msgp.Reader) (err error) {
var field []byte
_ = field
var zeff uint32
zeff, err = dc.ReadMapHeader()
if err != nil {
return
}
for zeff > 0 {
zeff--
field, err = dc.ReadMapKeyPtr()
if err != nil {
return
}
switch msgp.UnsafeString(field) {
case "start":
z.start, err = dc.ReadUint32()
if err != nil {
return
}
case "last":
z.last, err = dc.ReadUint32()
if err != nil {
return
}
default:
err = dc.Skip()
if err != nil {
return
}
}
}
return
}
示例2: DecodeMsg
func (r *Request) DecodeMsg(mr *msgp.Reader) error {
var bm msgp.Decodable
if r.Body != nil {
var ok bool
bm, ok = r.Body.(msgp.Decodable)
if !ok {
return ErrNotDecodable
}
}
if size, err := mr.ReadArrayHeader(); err != nil {
return err
} else if size != RequestPackSize {
return ErrBadPackSize
}
if typ, err := mr.ReadInt(); err != nil {
return err
} else if typ != RequestType {
return ErrBadMessageType
}
id, err := mr.ReadUint32()
if err != nil {
return err
}
r.ID = id
method, err := mr.ReadString()
if err != nil {
return err
}
r.Method = method
// The request body is packed in an array.
l, err := mr.ReadArrayHeader()
if err != nil {
return err
}
if l > 1 {
return ErrUnexpectedParams
} else if l == 0 {
return nil
}
r.hasBody = true
// Skip decoding the body if no value is present to decode into.
// The caller is expected to decode the body or skip it.
if bm != nil {
return decodeBody(mr, bm)
}
return nil
}
示例3: DecodeMsg
// DecodeMsg implements msgp.Decodable
func (z *Outgoing) DecodeMsg(dc *msgp.Reader) (err error) {
var field []byte
_ = field
var isz uint32
isz, err = dc.ReadMapHeader()
if err != nil {
return
}
for isz > 0 {
isz--
field, err = dc.ReadMapKeyPtr()
if err != nil {
return
}
switch msgp.UnsafeString(field) {
case "time":
z.Time, err = dc.ReadUint32()
if err != nil {
return
}
case "from":
z.From, err = dc.ReadString()
if err != nil {
return
}
case "message":
z.Message, err = dc.ReadString()
if err != nil {
return
}
default:
err = dc.Skip()
if err != nil {
return
}
}
}
return
}