Ejemplo n.º 1
0
// UnmarshalBson unmarshals QueryResultList from buf.
func (qrl *QueryResultList) UnmarshalBson(buf *bytes.Buffer) {
	bson.Next(buf, 4)

	kind := bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "List":
			qrl.List = tproto.DecodeResultsBson(buf, kind)
		case "Session":
			qrl.Session = new(Session)
			qrl.Session.UnmarshalBson(buf)
		case "Error":
			qrl.Error = bson.DecodeString(buf, kind)
		default:
			panic(bson.NewBsonError("Unrecognized tag %s", key))
		}
		kind = bson.NextByte(buf)
	}
}
Ejemplo n.º 2
0
// UnmarshalBson unmarshals QueryResultList from buf.
func (qrl *QueryResultList) UnmarshalBson(buf *bytes.Buffer, kind byte) {
	bson.VerifyObject(kind)
	bson.Next(buf, 4)

	kind = bson.NextByte(buf)
	for kind != bson.EOO {
		keyName := bson.ReadCString(buf)
		switch keyName {
		case "List":
			qrl.List = tproto.DecodeResultsBson(buf, kind)
		case "Session":
			if kind != bson.Null {
				qrl.Session = new(Session)
				qrl.Session.UnmarshalBson(buf, kind)
			}
		case "Error":
			qrl.Error = bson.DecodeString(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
		kind = bson.NextByte(buf)
	}
}