Example #1
0
func (kr *KeyRange) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Start", string(kr.Start))
	bson.EncodeString(buf, "End", string(kr.End))

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Example #2
0
func (resp *ResponseBson) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "ServiceMethod", resp.ServiceMethod)
	bson.EncodeInt64(buf, "Seq", int64(resp.Seq))
	bson.EncodeString(buf, "Error", resp.Error)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Example #3
0
func (bdq *BoundQuery) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Sql", bdq.Sql)
	EncodeBindVariablesBson(buf, "BindVariables", bdq.BindVariables)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Example #4
0
func MarshalFieldBson(field Field, key string, buf *bytes2.ChunkedWriter) {
	bson.EncodePrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Name", field.Name)
	bson.EncodeInt64(buf, "Type", field.Type)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Example #5
0
func (query *Query) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Sql", query.Sql)
	EncodeBindVariablesBson(buf, "BindVariables", query.BindVariables)
	bson.EncodeInt64(buf, "TransactionId", query.TransactionId)
	bson.EncodeInt64(buf, "ConnectionId", query.ConnectionId)
	bson.EncodeInt64(buf, "SessionId", query.SessionId)

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