// MarshalBson bson-encodes KeyspaceIdBatchQuery.
func (keyspaceIdBatchQuery *KeyspaceIdBatchQuery) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	// []tproto.BoundQuery
	{
		bson.EncodePrefix(buf, bson.Array, "Queries")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range keyspaceIdBatchQuery.Queries {
			_v1.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "Keyspace", keyspaceIdBatchQuery.Keyspace)
	// []kproto.KeyspaceId
	{
		bson.EncodePrefix(buf, bson.Array, "KeyspaceIds")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range keyspaceIdBatchQuery.KeyspaceIds {
			_v2.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	keyspaceIdBatchQuery.TabletType.MarshalBson(buf, "TabletType")
	// *Session
	if keyspaceIdBatchQuery.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*keyspaceIdBatchQuery.Session).MarshalBson(buf, "Session")
	}

	lenWriter.Close()
}
// MarshalBson bson-encodes QueryResult.
func (queryResult *QueryResult) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	// []Field
	{
		bson.EncodePrefix(buf, bson.Array, "Fields")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range queryResult.Fields {
			_v1.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	bson.EncodeUint64(buf, "RowsAffected", queryResult.RowsAffected)
	bson.EncodeUint64(buf, "InsertId", queryResult.InsertId)
	// [][]sqltypes.Value
	{
		bson.EncodePrefix(buf, bson.Array, "Rows")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range queryResult.Rows {
			// []sqltypes.Value
			{
				bson.EncodePrefix(buf, bson.Array, bson.Itoa(_i))
				lenWriter := bson.NewLenWriter(buf)
				for _i, _v3 := range _v2 {
					_v3.MarshalBson(buf, bson.Itoa(_i))
				}
				lenWriter.Close()
			}
		}
		lenWriter.Close()
	}

	lenWriter.Close()
}
Exemple #3
0
// MarshalBson bson-encodes SrvShard.
func (srvShard *SrvShard) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Name", srvShard.Name)
	srvShard.KeyRange.MarshalBson(buf, "KeyRange")
	// []TabletType
	{
		bson.EncodePrefix(buf, bson.Array, "ServedTypes")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range srvShard.ServedTypes {
			_v1.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "MasterCell", srvShard.MasterCell)
	// []TabletType
	{
		bson.EncodePrefix(buf, bson.Array, "TabletTypes")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range srvShard.TabletTypes {
			_v2.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}

	lenWriter.Close()
}
// MarshalBson bson-encodes BatchQueryShard.
func (batchQueryShard *BatchQueryShard) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	// []tproto.BoundQuery
	{
		bson.EncodePrefix(buf, bson.Array, "Queries")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range batchQueryShard.Queries {
			_v1.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "Keyspace", batchQueryShard.Keyspace)
	// []string
	{
		bson.EncodePrefix(buf, bson.Array, "Shards")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range batchQueryShard.Shards {
			bson.EncodeString(buf, bson.Itoa(_i), _v2)
		}
		lenWriter.Close()
	}
	batchQueryShard.TabletType.MarshalBson(buf, "TabletType")
	// *Session
	if batchQueryShard.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*batchQueryShard.Session).MarshalBson(buf, "Session")
	}
	bson.EncodeBool(buf, "NotInTransaction", batchQueryShard.NotInTransaction)

	lenWriter.Close()
}
Exemple #5
0
func EncodeRowBson(row []sqltypes.Value, key string, buf *bytes2.ChunkedWriter) {
	bson.EncodePrefix(buf, bson.Array, key)
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range row {
		if v.IsNull() {
			bson.EncodePrefix(buf, bson.Null, bson.Itoa(i))
		} else {
			bson.EncodeBinary(buf, bson.Itoa(i), v.Raw())
		}
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
// MarshalBson bson-encodes SrvKeyspace.
func (srvKeyspace *SrvKeyspace) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	// map[TabletType]*KeyspacePartition
	{
		bson.EncodePrefix(buf, bson.Object, "Partitions")
		lenWriter := bson.NewLenWriter(buf)
		for _k, _v1 := range srvKeyspace.Partitions {
			// *KeyspacePartition
			if _v1 == nil {
				bson.EncodePrefix(buf, bson.Null, string(_k))
			} else {
				(*_v1).MarshalBson(buf, string(_k))
			}
		}
		lenWriter.Close()
	}
	// []SrvShard
	{
		bson.EncodePrefix(buf, bson.Array, "Shards")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range srvKeyspace.Shards {
			_v2.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	// []TabletType
	{
		bson.EncodePrefix(buf, bson.Array, "TabletTypes")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v3 := range srvKeyspace.TabletTypes {
			_v3.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "ShardingColumnName", srvKeyspace.ShardingColumnName)
	srvKeyspace.ShardingColumnType.MarshalBson(buf, "ShardingColumnType")
	// map[TabletType]string
	{
		bson.EncodePrefix(buf, bson.Object, "ServedFrom")
		lenWriter := bson.NewLenWriter(buf)
		for _k, _v4 := range srvKeyspace.ServedFrom {
			bson.EncodeString(buf, string(_k), _v4)
		}
		lenWriter.Close()
	}
	bson.EncodeInt32(buf, "SplitShardCount", srvKeyspace.SplitShardCount)

	lenWriter.Close()
}
// MarshalBson bson-encodes BoundShardQuery.
func (boundShardQuery *BoundShardQuery) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Sql", boundShardQuery.Sql)
	// map[string]interface{}
	{
		bson.EncodePrefix(buf, bson.Object, "BindVariables")
		lenWriter := bson.NewLenWriter(buf)
		for _k, _v1 := range boundShardQuery.BindVariables {
			bson.EncodeInterface(buf, _k, _v1)
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "Keyspace", boundShardQuery.Keyspace)
	// []string
	{
		bson.EncodePrefix(buf, bson.Array, "Shards")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range boundShardQuery.Shards {
			bson.EncodeString(buf, bson.Itoa(_i), _v2)
		}
		lenWriter.Close()
	}

	lenWriter.Close()
}
// MarshalBson bson-encodes BatchQueryShard.
func (batchQueryShard *BatchQueryShard) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	// *tproto.CallerID
	if batchQueryShard.CallerID == nil {
		bson.EncodePrefix(buf, bson.Null, "CallerID")
	} else {
		(*batchQueryShard.CallerID).MarshalBson(buf, "CallerID")
	}
	// []BoundShardQuery
	{
		bson.EncodePrefix(buf, bson.Array, "Queries")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range batchQueryShard.Queries {
			_v1.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	batchQueryShard.TabletType.MarshalBson(buf, "TabletType")
	bson.EncodeBool(buf, "AsTransaction", batchQueryShard.AsTransaction)
	// *Session
	if batchQueryShard.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*batchQueryShard.Session).MarshalBson(buf, "Session")
	}

	lenWriter.Close()
}
// MarshalBson bson-encodes QueryShard.
func (queryShard *QueryShard) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Sql", queryShard.Sql)
	// map[string]interface{}
	{
		bson.EncodePrefix(buf, bson.Object, "BindVariables")
		lenWriter := bson.NewLenWriter(buf)
		for _k, _v1 := range queryShard.BindVariables {
			bson.EncodeInterface(buf, _k, _v1)
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "Keyspace", queryShard.Keyspace)
	// []string
	{
		bson.EncodePrefix(buf, bson.Array, "Shards")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range queryShard.Shards {
			bson.EncodeString(buf, bson.Itoa(_i), _v2)
		}
		lenWriter.Close()
	}
	queryShard.TabletType.MarshalBson(buf, "TabletType")
	// *Session
	if queryShard.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*queryShard.Session).MarshalBson(buf, "Session")
	}
	bson.EncodeBool(buf, "NotInTransaction", queryShard.NotInTransaction)

	lenWriter.Close()
}
// MarshalBson bson-encodes KeyspaceIdQuery.
func (keyspaceIdQuery *KeyspaceIdQuery) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Sql", keyspaceIdQuery.Sql)
	// map[string]interface{}
	{
		bson.EncodePrefix(buf, bson.Object, "BindVariables")
		lenWriter := bson.NewLenWriter(buf)
		for _k, _v1 := range keyspaceIdQuery.BindVariables {
			bson.EncodeInterface(buf, _k, _v1)
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "Keyspace", keyspaceIdQuery.Keyspace)
	// []kproto.KeyspaceId
	{
		bson.EncodePrefix(buf, bson.Array, "KeyspaceIds")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range keyspaceIdQuery.KeyspaceIds {
			_v2.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	keyspaceIdQuery.TabletType.MarshalBson(buf, "TabletType")
	// *Session
	if keyspaceIdQuery.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*keyspaceIdQuery.Session).MarshalBson(buf, "Session")
	}

	lenWriter.Close()
}
Exemple #11
0
// MarshalBson bson-encodes QueryResult.
func (queryResult *QueryResult) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	// []*query.Field
	{
		bson.EncodePrefix(buf, bson.Array, "Fields")
		lenWriter := bson.NewLenWriter(buf)
		var f BSONField
		for _i, _v1 := range queryResult.Fields {
			// *query.Field
			// This part was manually changed.
			f.Name = _v1.Name
			f.Type, f.Flags = sqltypes.TypeToMySQL(_v1.Type)
			bson.EncodeOptionalPrefix(buf, bson.Object, bson.Itoa(_i))
			bson.MarshalToBuffer(buf, &f)
		}
		lenWriter.Close()
	}
	bson.EncodeUint64(buf, "RowsAffected", queryResult.RowsAffected)
	bson.EncodeUint64(buf, "InsertId", queryResult.InsertId)
	// [][]sqltypes.Value
	{
		bson.EncodePrefix(buf, bson.Array, "Rows")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range queryResult.Rows {
			// []sqltypes.Value
			{
				bson.EncodePrefix(buf, bson.Array, bson.Itoa(_i))
				lenWriter := bson.NewLenWriter(buf)
				for _i, _v3 := range _v2 {
					_v3.MarshalBson(buf, bson.Itoa(_i))
				}
				lenWriter.Close()
			}
		}
		lenWriter.Close()
	}
	// *RPCError
	if queryResult.Err == nil {
		bson.EncodePrefix(buf, bson.Null, "Err")
	} else {
		(*queryResult.Err).MarshalBson(buf, "Err")
	}

	lenWriter.Close()
}
Exemple #12
0
func MarshalStatementsBson(buf *bytes2.ChunkedWriter, key string, statements []Statement) {
	bson.EncodePrefix(buf, bson.Array, key)
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range statements {
		v.MarshalBson(buf, bson.Itoa(i))
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Exemple #13
0
func encodeFieldsBson(fields []Field, buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range fields {
		bson.EncodePrefix(buf, bson.Object, bson.Itoa(i))
		MarshalFieldBson(v, buf)
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Exemple #14
0
func EncodeFieldsBson(fields []Field, key string, buf *bytes2.ChunkedWriter) {
	bson.EncodePrefix(buf, bson.Array, key)
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range fields {
		MarshalFieldBson(v, bson.Itoa(i), buf)
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Exemple #15
0
func encodeQueriesBson(queries []BoundQuery, buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range queries {
		bson.EncodePrefix(buf, bson.Object, bson.Itoa(i))
		v.MarshalBson(buf)
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Exemple #16
0
func MarshalPKRowBson(buf *bytes2.ChunkedWriter, key string, pkRow []interface{}) {
	bson.EncodePrefix(buf, bson.Array, key)
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range pkRow {
		bson.EncodeField(buf, bson.Itoa(i), v)
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Exemple #17
0
func EncodeResultsBson(results []mproto.QueryResult, key string, buf *bytes2.ChunkedWriter) {
	bson.EncodePrefix(buf, bson.Array, key)
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range results {
		v.MarshalBson(buf, bson.Itoa(i))
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Exemple #18
0
func MarshalPKValuesBson(buf *bytes2.ChunkedWriter, key string, pkValues [][]interface{}) {
	bson.EncodePrefix(buf, bson.Array, key)
	lenWriter := bson.NewLenWriter(buf)
	for i, row := range pkValues {
		MarshalPKRowBson(buf, bson.Itoa(i), row)
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Exemple #19
0
func encodeShardSessionsBson(shardSessions []*ShardSession, key string, buf *bytes2.ChunkedWriter) {
	bson.EncodePrefix(buf, bson.Array, key)
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range shardSessions {
		v.MarshalBson(buf, bson.Itoa(i))
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Exemple #20
0
func EncodeQueriesBson(queries []BoundQuery, key string, buf *bytes2.ChunkedWriter) {
	bson.EncodePrefix(buf, bson.Array, key)
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range queries {
		v.MarshalBson(buf, bson.Itoa(i))
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Exemple #21
0
func EncodeRowsBson(rows [][]sqltypes.Value, key string, buf *bytes2.ChunkedWriter) {
	bson.EncodePrefix(buf, bson.Array, key)
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range rows {
		EncodeRowBson(v, bson.Itoa(i), buf)
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Exemple #22
0
// MarshalBson bson-encodes QueryResult.
func (queryResult *QueryResult) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	// []mproto.Field
	{
		bson.EncodePrefix(buf, bson.Array, "Fields")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range queryResult.Fields {
			_v1.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	bson.EncodeUint64(buf, "RowsAffected", queryResult.RowsAffected)
	bson.EncodeUint64(buf, "InsertId", queryResult.InsertId)
	// [][]sqltypes.Value
	{
		bson.EncodePrefix(buf, bson.Array, "Rows")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range queryResult.Rows {
			// []sqltypes.Value
			{
				bson.EncodePrefix(buf, bson.Array, bson.Itoa(_i))
				lenWriter := bson.NewLenWriter(buf)
				for _i, _v3 := range _v2 {
					_v3.MarshalBson(buf, bson.Itoa(_i))
				}
				lenWriter.Close()
			}
		}
		lenWriter.Close()
	}
	// *Session
	if queryResult.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*queryResult.Session).MarshalBson(buf, "Session")
	}
	bson.EncodeString(buf, "Error", queryResult.Error)

	lenWriter.Close()
}
Exemple #23
0
// MarshalBson bson-encodes ZkNodeV.
func (zkNodeV *ZkNodeV) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	// []*ZkNode
	{
		bson.EncodePrefix(buf, bson.Array, "Nodes")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range zkNodeV.Nodes {
			// *ZkNode
			if _v1 == nil {
				bson.EncodePrefix(buf, bson.Null, bson.Itoa(_i))
			} else {
				(*_v1).MarshalBson(buf, bson.Itoa(_i))
			}
		}
		lenWriter.Close()
	}

	lenWriter.Close()
}
Exemple #24
0
func EncodeTabletTypeArray(buf *bytes2.ChunkedWriter, name string, values []TabletType) {
	if len(values) == 0 {
		bson.EncodePrefix(buf, bson.Null, name)
	} else {
		bson.EncodePrefix(buf, bson.Array, name)
		lenWriter := bson.NewLenWriter(buf)
		for i, val := range values {
			bson.EncodeString(buf, bson.Itoa(i), string(val))
		}
		buf.WriteByte(0)
		lenWriter.RecordLen()
	}
}
Exemple #25
0
func marshalZkNodeArray(buf *bytes2.ChunkedWriter, name string, values []*ZkNode) {
	if values == nil {
		bson.EncodePrefix(buf, bson.Null, name)
	} else {
		bson.EncodePrefix(buf, bson.Array, name)
		lenWriter := bson.NewLenWriter(buf)
		for i, val := range values {
			val.MarshalBson(buf, bson.Itoa(i))
		}
		buf.WriteByte(0)
		lenWriter.RecordLen()
	}
}
Exemple #26
0
// MarshalBson bson-encodes Session.
func (session *Session) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeBool(buf, "InTransaction", session.InTransaction)
	// []*ShardSession
	{
		bson.EncodePrefix(buf, bson.Array, "ShardSessions")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range session.ShardSessions {
			// *ShardSession
			if _v1 == nil {
				bson.EncodePrefix(buf, bson.Null, bson.Itoa(_i))
			} else {
				(*_v1).MarshalBson(buf, bson.Itoa(_i))
			}
		}
		lenWriter.Close()
	}

	lenWriter.Close()
}
Exemple #27
0
func EncodeSrvShardArray(buf *bytes2.ChunkedWriter, name string, values []SrvShard) {
	if len(values) == 0 {
		bson.EncodePrefix(buf, bson.Null, name)
	} else {
		bson.EncodePrefix(buf, bson.Array, name)
		lenWriter := bson.NewLenWriter(buf)
		for i, val := range values {
			val.MarshalBson(buf, bson.Itoa(i))
		}
		buf.WriteByte(0)
		lenWriter.RecordLen()
	}
}
// MarshalBson bson-encodes StreamEvent.
func (streamEvent *StreamEvent) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Category", streamEvent.Category)
	bson.EncodeString(buf, "TableName", streamEvent.TableName)
	// []string
	{
		bson.EncodePrefix(buf, bson.Array, "PKColNames")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range streamEvent.PKColNames {
			bson.EncodeString(buf, bson.Itoa(_i), _v1)
		}
		lenWriter.Close()
	}
	// [][]interface{}
	{
		bson.EncodePrefix(buf, bson.Array, "PKValues")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range streamEvent.PKValues {
			// []interface{}
			{
				bson.EncodePrefix(buf, bson.Array, bson.Itoa(_i))
				lenWriter := bson.NewLenWriter(buf)
				for _i, _v3 := range _v2 {
					bson.EncodeInterface(buf, bson.Itoa(_i), _v3)
				}
				lenWriter.Close()
			}
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "Sql", streamEvent.Sql)
	bson.EncodeInt64(buf, "Timestamp", streamEvent.Timestamp)
	streamEvent.GTIDField.MarshalBson(buf, "GTIDField")

	lenWriter.Close()
}
Exemple #29
0
// MarshalBson bson-encodes StreamEvent.
func (streamEvent *StreamEvent) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Category", streamEvent.Category)
	bson.EncodeString(buf, "TableName", streamEvent.TableName)
	// []mproto.Field
	{
		bson.EncodePrefix(buf, bson.Array, "PrimaryKeyFields")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range streamEvent.PrimaryKeyFields {
			_v1.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	// [][]sqltypes.Value
	{
		bson.EncodePrefix(buf, bson.Array, "PrimaryKeyValues")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range streamEvent.PrimaryKeyValues {
			// []sqltypes.Value
			{
				bson.EncodePrefix(buf, bson.Array, bson.Itoa(_i))
				lenWriter := bson.NewLenWriter(buf)
				for _i, _v3 := range _v2 {
					_v3.MarshalBson(buf, bson.Itoa(_i))
				}
				lenWriter.Close()
			}
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "Sql", streamEvent.Sql)
	bson.EncodeInt64(buf, "Timestamp", streamEvent.Timestamp)
	bson.EncodeString(buf, "TransactionID", streamEvent.TransactionID)

	lenWriter.Close()
}
// MarshalBson bson-encodes SrvKeyspaceNames.
func (srvKeyspaceNames *SrvKeyspaceNames) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	// []string
	{
		bson.EncodePrefix(buf, bson.Array, "Entries")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range srvKeyspaceNames.Entries {
			bson.EncodeString(buf, bson.Itoa(_i), _v1)
		}
		lenWriter.Close()
	}

	lenWriter.Close()
}