// MarshalBson bson-encodes Session. func (session *Session) MarshalBson(buf *bytes2.ChunkedWriter, key string) { bson.EncodeOptionalPrefix(buf, bson.Object, key) lenWriter := bson.NewLenWriter(buf) bson.EncodeInt64(buf, "SessionId", session.SessionId) bson.EncodeInt64(buf, "TransactionId", session.TransactionId) lenWriter.Close() }
// MarshalBson bson-encodes MyType. func (myType *MyType) MarshalBson(buf *bytes2.ChunkedWriter, key string) { bson.EncodeOptionalPrefix(buf, bson.Object, key) lenWriter := bson.NewLenWriter(buf) bson.EncodeInt64(buf, "Val", myType.Val) lenWriter.Close() }
// MarshalBson bson-encodes Field. func (field *Field) MarshalBson(buf *bytes2.ChunkedWriter, key string) { bson.EncodeOptionalPrefix(buf, bson.Object, key) lenWriter := bson.NewLenWriter(buf) bson.EncodeString(buf, "Name", field.Name) bson.EncodeInt64(buf, "Type", field.Type) lenWriter.Close() }
// MarshalBson bson-encodes QueryList. func (queryList *QueryList) MarshalBson(buf *bytes2.ChunkedWriter, key string) { bson.EncodeOptionalPrefix(buf, bson.Object, key) lenWriter := bson.NewLenWriter(buf) // []BoundQuery { bson.EncodePrefix(buf, bson.Array, "Queries") lenWriter := bson.NewLenWriter(buf) for _i, _v1 := range queryList.Queries { _v1.MarshalBson(buf, bson.Itoa(_i)) } lenWriter.Close() } bson.EncodeInt64(buf, "SessionId", queryList.SessionId) bson.EncodeInt64(buf, "TransactionId", queryList.TransactionId) lenWriter.Close() }
// MarshalBson bson-encodes ZkStat. func (zkStat *ZkStat) MarshalBson(buf *bytes2.ChunkedWriter, key string) { bson.EncodeOptionalPrefix(buf, bson.Object, key) lenWriter := bson.NewLenWriter(buf) bson.EncodeInt64(buf, "Czxid", zkStat.czxid) bson.EncodeInt64(buf, "Mzxid", zkStat.mzxid) bson.EncodeTime(buf, "CTime", zkStat.cTime) bson.EncodeTime(buf, "MTime", zkStat.mTime) bson.EncodeInt(buf, "Version", zkStat.version) bson.EncodeInt(buf, "CVersion", zkStat.cVersion) bson.EncodeInt(buf, "AVersion", zkStat.aVersion) bson.EncodeInt64(buf, "EphemeralOwner", zkStat.ephemeralOwner) bson.EncodeInt(buf, "DataLength", zkStat.dataLength) bson.EncodeInt(buf, "NumChildren", zkStat.numChildren) bson.EncodeInt64(buf, "Pzxid", zkStat.pzxid) lenWriter.Close() }
// MarshalBson bson-encodes Query. func (query *Query) MarshalBson(buf *bytes2.ChunkedWriter, key string) { bson.EncodeOptionalPrefix(buf, bson.Object, key) lenWriter := bson.NewLenWriter(buf) bson.EncodeString(buf, "Sql", query.Sql) // map[string]interface{} { bson.EncodePrefix(buf, bson.Object, "BindVariables") lenWriter := bson.NewLenWriter(buf) for _k, _v1 := range query.BindVariables { bson.EncodeInterface(buf, _k, _v1) } lenWriter.Close() } bson.EncodeInt64(buf, "SessionId", query.SessionId) bson.EncodeInt64(buf, "TransactionId", query.TransactionId) lenWriter.Close() }
// MarshalBson bson-encodes ShardSession. func (shardSession *ShardSession) MarshalBson(buf *bytes2.ChunkedWriter, key string) { bson.EncodeOptionalPrefix(buf, bson.Object, key) lenWriter := bson.NewLenWriter(buf) bson.EncodeString(buf, "Keyspace", shardSession.Keyspace) bson.EncodeString(buf, "Shard", shardSession.Shard) shardSession.TabletType.MarshalBson(buf, "TabletType") bson.EncodeInt64(buf, "TransactionId", shardSession.TransactionId) lenWriter.Close() }
// MarshalBson bson-encodes BinlogTransaction. func (binlogTransaction *BinlogTransaction) MarshalBson(buf *bytes2.ChunkedWriter, key string) { bson.EncodeOptionalPrefix(buf, bson.Object, key) lenWriter := bson.NewLenWriter(buf) // []Statement { bson.EncodePrefix(buf, bson.Array, "Statements") lenWriter := bson.NewLenWriter(buf) for _i, _v1 := range binlogTransaction.Statements { _v1.MarshalBson(buf, bson.Itoa(_i)) } lenWriter.Close() } bson.EncodeInt64(buf, "Timestamp", binlogTransaction.Timestamp) binlogTransaction.GTIDField.MarshalBson(buf, "GTIDField") lenWriter.Close() }
// MarshalBson bson-encodes MyType. func (myType *MyType) MarshalBson(buf *bytes2.ChunkedWriter, key string) { bson.EncodeOptionalPrefix(buf, bson.Object, key) lenWriter := bson.NewLenWriter(buf) bson.EncodeFloat64(buf, "Float64", myType.Float64) bson.EncodeString(buf, "String", myType.String) bson.EncodeBool(buf, "Bool", myType.Bool) bson.EncodeInt64(buf, "Int64", myType.Int64) bson.EncodeInt32(buf, "Int32", myType.Int32) bson.EncodeInt(buf, "Int", myType.Int) bson.EncodeUint64(buf, "Uint64", myType.Uint64) bson.EncodeUint32(buf, "Uint32", myType.Uint32) bson.EncodeUint(buf, "Uint", myType.Uint) bson.EncodeBinary(buf, "Bytes", myType.Bytes) bson.EncodeTime(buf, "Time", myType.Time) bson.EncodeInterface(buf, "Interface", myType.Interface) lenWriter.Close() }
// 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() }
// MarshalBson bson-encodes MyType. func (myType *MyType) MarshalBson(buf *bytes2.ChunkedWriter, key string) { bson.EncodeOptionalPrefix(buf, bson.Object, key) lenWriter := bson.NewLenWriter(buf) // *int64 if myType.Ptr == nil { bson.EncodePrefix(buf, bson.Null, "Ptr") } else { bson.EncodeInt64(buf, "Ptr", (*myType.Ptr)) } // **int64 if myType.PtrPtr == nil { bson.EncodePrefix(buf, bson.Null, "PtrPtr") } else { // *int64 if (*myType.PtrPtr) == nil { bson.EncodePrefix(buf, bson.Null, "PtrPtr") } else { bson.EncodeInt64(buf, "PtrPtr", (*(*myType.PtrPtr))) } } // *[]byte if myType.PtrBytes == nil { bson.EncodePrefix(buf, bson.Null, "PtrBytes") } else { bson.EncodeBinary(buf, "PtrBytes", (*myType.PtrBytes)) } // *[]int64 if myType.PtrSlice == nil { bson.EncodePrefix(buf, bson.Null, "PtrSlice") } else { // []int64 { bson.EncodePrefix(buf, bson.Array, "PtrSlice") lenWriter := bson.NewLenWriter(buf) for _i, _v1 := range *myType.PtrSlice { bson.EncodeInt64(buf, bson.Itoa(_i), _v1) } lenWriter.Close() } } // *map[string]int64 if myType.PtrMap == nil { bson.EncodePrefix(buf, bson.Null, "PtrMap") } else { // map[string]int64 { bson.EncodePrefix(buf, bson.Object, "PtrMap") lenWriter := bson.NewLenWriter(buf) for _k, _v2 := range *myType.PtrMap { bson.EncodeInt64(buf, _k, _v2) } lenWriter.Close() } } // *Custom if myType.PtrCustom == nil { bson.EncodePrefix(buf, bson.Null, "PtrCustom") } else { (*myType.PtrCustom).MarshalBson(buf, "PtrCustom") } lenWriter.Close() }
// MarshalBson bson-encodes MyType. func (myType *MyType) MarshalBson(buf *bytes2.ChunkedWriter, key string) { bson.EncodeOptionalPrefix(buf, bson.Object, key) lenWriter := bson.NewLenWriter(buf) // map[string]string { bson.EncodePrefix(buf, bson.Object, "Map") lenWriter := bson.NewLenWriter(buf) for _k, _v1 := range myType.Map { bson.EncodeString(buf, _k, _v1) } lenWriter.Close() } // map[string][]byte { bson.EncodePrefix(buf, bson.Object, "MapBytes") lenWriter := bson.NewLenWriter(buf) for _k, _v2 := range myType.MapBytes { bson.EncodeBinary(buf, _k, _v2) } lenWriter.Close() } // map[string]*string { bson.EncodePrefix(buf, bson.Object, "MapPtr") lenWriter := bson.NewLenWriter(buf) for _k, _v3 := range myType.MapPtr { // *string if _v3 == nil { bson.EncodePrefix(buf, bson.Null, _k) } else { bson.EncodeString(buf, _k, (*_v3)) } } lenWriter.Close() } // map[string][]string { bson.EncodePrefix(buf, bson.Object, "MapSlice") lenWriter := bson.NewLenWriter(buf) for _k, _v4 := range myType.MapSlice { // []string { bson.EncodePrefix(buf, bson.Array, _k) lenWriter := bson.NewLenWriter(buf) for _i, _v5 := range _v4 { bson.EncodeString(buf, bson.Itoa(_i), _v5) } lenWriter.Close() } } lenWriter.Close() } // map[string]map[string]int64 { bson.EncodePrefix(buf, bson.Object, "MapMap") lenWriter := bson.NewLenWriter(buf) for _k, _v6 := range myType.MapMap { // map[string]int64 { bson.EncodePrefix(buf, bson.Object, _k) lenWriter := bson.NewLenWriter(buf) for _k, _v7 := range _v6 { bson.EncodeInt64(buf, _k, _v7) } lenWriter.Close() } } lenWriter.Close() } // map[string]Custom { bson.EncodePrefix(buf, bson.Object, "MapCustom") lenWriter := bson.NewLenWriter(buf) for _k, _v8 := range myType.MapCustom { _v8.MarshalBson(buf, _k) } lenWriter.Close() } // map[string]*Custom { bson.EncodePrefix(buf, bson.Object, "MapCustomPtr") lenWriter := bson.NewLenWriter(buf) for _k, _v9 := range myType.MapCustomPtr { // *Custom if _v9 == nil { bson.EncodePrefix(buf, bson.Null, _k) } else { (*_v9).MarshalBson(buf, _k) } } lenWriter.Close() } // map[Custom]string { bson.EncodePrefix(buf, bson.Object, "CustomMap") lenWriter := bson.NewLenWriter(buf) for _k, _v10 := range myType.CustomMap { bson.EncodeString(buf, string(_k), _v10) } lenWriter.Close() } // map[pkg.Custom]string { bson.EncodePrefix(buf, bson.Object, "MapExternal") lenWriter := bson.NewLenWriter(buf) for _k, _v11 := range myType.MapExternal { bson.EncodeString(buf, string(_k), _v11) } lenWriter.Close() } lenWriter.Close() }