コード例 #1
0
// UnmarshalMsg implements msgp.Unmarshaler
func (z *DocumentID) UnmarshalMsg(bts []byte) (o []byte, err error) {
	{
		var tmp uint
		tmp, bts, err = msgp.ReadUintBytes(bts)
		(*z) = DocumentID(tmp)
	}
	if err != nil {
		return
	}
	o = bts
	return
}
コード例 #2
0
// UnmarshalMsg implements msgp.Unmarshaler
func (z *DocumentList) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var xsz uint32
	xsz, bts, err = msgp.ReadArrayHeaderBytes(bts)
	if err != nil {
		return
	}
	if cap((*z)) >= int(xsz) {
		(*z) = (*z)[:xsz]
	} else {
		(*z) = make(DocumentList, xsz)
	}
	for cmr := range *z {
		{
			var tmp uint
			tmp, bts, err = msgp.ReadUintBytes(bts)
			(*z)[cmr] = DocumentID(tmp)
		}
		if err != nil {
			return
		}
	}
	o = bts
	return
}