func (session *Session) UnmarshalBson(buf *bytes.Buffer) { bson.Next(buf, 4) kind := bson.NextByte(buf) for kind != bson.EOO { key := bson.ReadCString(buf) switch key { case "TransactionId": session.TransactionId = bson.DecodeInt64(buf, kind) case "ConnectionId": session.ConnectionId = bson.DecodeInt64(buf, kind) case "SessionId": session.SessionId = bson.DecodeInt64(buf, kind) default: panic(bson.NewBsonError("Unrecognized tag %s", key)) } kind = bson.NextByte(buf) } }
func (query *Query) UnmarshalBson(buf *bytes.Buffer) { bson.Next(buf, 4) kind := bson.NextByte(buf) for kind != bson.EOO { key := bson.ReadCString(buf) switch key { case "Sql": query.Sql = bson.DecodeString(buf, kind) case "BindVariables": query.BindVariables = DecodeBindVariablesBson(buf, kind) case "TransactionId": query.TransactionId = bson.DecodeInt64(buf, kind) case "ConnectionId": query.ConnectionId = bson.DecodeInt64(buf, kind) case "SessionId": query.SessionId = bson.DecodeInt64(buf, kind) default: panic(bson.NewBsonError("Unrecognized tag %s", key)) } kind = bson.NextByte(buf) } }
func UnmarshalFieldBson(field *Field, buf *bytes.Buffer) { bson.Next(buf, 4) kind := bson.NextByte(buf) for kind != bson.EOO { key := bson.ReadCString(buf) switch key { case "Name": field.Name = bson.DecodeString(buf, kind) case "Type": field.Type = bson.DecodeInt64(buf, kind) default: panic(bson.NewBsonError("Unrecognized tag %s", key)) } kind = bson.NextByte(buf) } }