コード例 #1
0
ファイル: bson.go プロジェクト: dongzerun/RationalDb
func (session *Session) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeInt64(buf, "TransactionId", session.TransactionId)
	bson.EncodeInt64(buf, "ConnectionId", session.ConnectionId)
	bson.EncodeInt64(buf, "SessionId", session.SessionId)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
コード例 #2
0
ファイル: bson.go プロジェクト: dongzerun/RationalDb
func (qr *QueryResult) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	encodeFieldsBson(qr.Fields, "Fields", buf)
	bson.EncodeInt64(buf, "RowsAffected", int64(qr.RowsAffected))
	bson.EncodeInt64(buf, "InsertId", int64(qr.InsertId))
	encodeRowsBson(qr.Rows, "Rows", buf)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
コード例 #3
0
ファイル: bson.go プロジェクト: dongzerun/RationalDb
func (ql *QueryList) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	EncodeQueriesBson(ql.Queries, "Queries", buf)
	bson.EncodeInt64(buf, "TransactionId", ql.TransactionId)
	bson.EncodeInt64(buf, "ConnectionId", ql.ConnectionId)
	bson.EncodeInt64(buf, "SessionId", ql.SessionId)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
コード例 #4
0
ファイル: bson.go プロジェクト: dongzerun/RationalDb
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()
}
コード例 #5
0
ファイル: custom_codecs.go プロジェクト: dongzerun/RationalDb
func (req *RequestBson) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

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

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
コード例 #6
0
ファイル: bson.go プロジェクト: dongzerun/RationalDb
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()
}