// MarshalBson bson-encodes BlpPosition. func (blpPosition *BlpPosition) MarshalBson(buf *bytes2.ChunkedWriter, key string) { bson.EncodeOptionalPrefix(buf, bson.Object, key) lenWriter := bson.NewLenWriter(buf) bson.EncodeUint32(buf, "Uid", blpPosition.Uid) blpPosition.GTIDField.MarshalBson(buf, "GTIDField") lenWriter.Close() }
func (zkStat *ZkStat) MarshalBson(buf *bytes2.ChunkedWriter) { lenWriter := bson.NewLenWriter(buf) bson.EncodePrefix(buf, bson.Long, "Czxid") bson.EncodeUint64(buf, uint64(zkStat.czxid)) bson.EncodePrefix(buf, bson.Long, "Mzxid") bson.EncodeUint64(buf, uint64(zkStat.mzxid)) bson.EncodePrefix(buf, bson.Datetime, "CTime") bson.EncodeTime(buf, zkStat.cTime) bson.EncodePrefix(buf, bson.Datetime, "MTime") bson.EncodeTime(buf, zkStat.mTime) bson.EncodePrefix(buf, bson.Int, "Version") bson.EncodeUint32(buf, uint32(zkStat.version)) bson.EncodePrefix(buf, bson.Int, "CVersion") bson.EncodeUint32(buf, uint32(zkStat.cVersion)) bson.EncodePrefix(buf, bson.Int, "AVersion") bson.EncodeUint32(buf, uint32(zkStat.aVersion)) bson.EncodePrefix(buf, bson.Long, "EphemeralOwner") bson.EncodeUint64(buf, uint64(zkStat.ephemeralOwner)) bson.EncodePrefix(buf, bson.Int, "DataLength") bson.EncodeUint32(buf, uint32(zkStat.dataLength)) bson.EncodePrefix(buf, bson.Int, "NumChildren") bson.EncodeUint32(buf, uint32(zkStat.numChildren)) bson.EncodePrefix(buf, bson.Long, "Pzxid") bson.EncodeUint64(buf, uint64(zkStat.pzxid)) buf.WriteByte(0) lenWriter.RecordLen() }
// 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() }