예제 #1
0
func (self *Session) MarshalBson(buf *bytes.Buffer) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Long, "TransactionId")
	bson.EncodeUint64(buf, uint64(self.TransactionId))

	bson.EncodePrefix(buf, bson.Long, "ConnectionId")
	bson.EncodeUint64(buf, uint64(self.ConnectionId))

	bson.EncodePrefix(buf, bson.Long, "SessionId")
	bson.EncodeUint64(buf, uint64(self.SessionId))

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
예제 #2
0
func (self *QueryResult) MarshalBson(buf *bytes.Buffer) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Array, "Fields")
	self.encodeFieldsBson(buf)

	bson.EncodePrefix(buf, bson.Long, "RowsAffected")
	bson.EncodeUint64(buf, uint64(self.RowsAffected))

	bson.EncodePrefix(buf, bson.Long, "InsertId")
	bson.EncodeUint64(buf, uint64(self.InsertId))

	bson.EncodePrefix(buf, bson.Array, "Rows")
	self.encodeRowsBson(buf)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
예제 #3
0
func (self *RequestBson) MarshalBson(buf *bytes.Buffer) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Binary, "ServiceMethod")
	bson.EncodeString(buf, self.ServiceMethod)

	bson.EncodePrefix(buf, bson.Long, "Seq")
	bson.EncodeUint64(buf, uint64(self.Seq))

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
예제 #4
0
func MarshalFieldBson(self mysql.Field, buf *bytes.Buffer) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Binary, "Name")
	bson.EncodeString(buf, self.Name)

	bson.EncodePrefix(buf, bson.Long, "Type")
	bson.EncodeUint64(buf, uint64(self.Type))

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
예제 #5
0
func (self *Query) MarshalBson(buf *bytes.Buffer) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Binary, "Sql")
	bson.EncodeString(buf, self.Sql)

	bson.EncodePrefix(buf, bson.Object, "BindVariables")
	self.encodeBindVariablesBson(buf)

	bson.EncodePrefix(buf, bson.Long, "TransactionId")
	bson.EncodeUint64(buf, uint64(self.TransactionId))

	bson.EncodePrefix(buf, bson.Long, "ConnectionId")
	bson.EncodeUint64(buf, uint64(self.ConnectionId))

	bson.EncodePrefix(buf, bson.Long, "SessionId")
	bson.EncodeUint64(buf, uint64(self.SessionId))

	buf.WriteByte(0)
	lenWriter.RecordLen()
}