Exemplo n.º 1
0
func (t *TReader) string(r *marshal.Reader, v reflect.Value) {
	if l := r.Uint32(); l >= 1 {
		sz := r.Intvar()
		v.SetString(r.String(sz))
	} else {
		r.Err = fmt.Errorf("Wrong field count: expect 1, got %d", l)
	}
}
Exemplo n.º 2
0
func oneFieldTuple(r *marshal.Reader, sz int) bool {
	var l, s int
	if l = r.IntUint32(); l >= 1 {
		if s = r.Intvar(); s == sz {
			return true
		} else {
			r.Err = fmt.Errorf("Wrong field size: expect 1, got %d", l)
		}
	} else {
		r.Err = fmt.Errorf("Wrong field count: expect 1, got %d", l)
	}
	return false
}