예제 #1
0
func (bdq *BoundQuery) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

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

	bson.EncodePrefix(buf, bson.Object, "BindVariables")
	vproto.EncodeBindVariablesBson(buf, bdq.BindVariables)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
예제 #2
0
func (sqs *StreamQueryKeyRange) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Sql", sqs.Sql)
	tproto.EncodeBindVariablesBson(buf, "BindVariables", sqs.BindVariables)
	bson.EncodeString(buf, "Keyspace", sqs.Keyspace)
	bson.EncodeString(buf, "KeyRange", sqs.KeyRange)
	bson.EncodeString(buf, "TabletType", string(sqs.TabletType))

	if sqs.Session != nil {
		sqs.Session.MarshalBson(buf, "Session")
	}

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
예제 #3
0
// MarshalBson marshals QueryShard into buf.
func (qrs *QueryShard) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Sql", qrs.Sql)
	tproto.EncodeBindVariablesBson(buf, "BindVariables", qrs.BindVariables)
	bson.EncodeString(buf, "Keyspace", qrs.Keyspace)
	bson.EncodeStringArray(buf, "Shards", qrs.Shards)
	bson.EncodeString(buf, "TabletType", string(qrs.TabletType))

	if qrs.Session != nil {
		qrs.Session.MarshalBson(buf, "Session")
	}

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
예제 #4
0
func (qrs *QueryShard) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

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

	bson.EncodePrefix(buf, bson.Object, "BindVariables")
	vproto.EncodeBindVariablesBson(buf, qrs.BindVariables)

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

	bson.EncodePrefix(buf, bson.Binary, "Keyspace")
	bson.EncodeString(buf, qrs.Keyspace)

	bson.EncodeStringArray(buf, "Shards", qrs.Shards)

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