forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 1
/
binlog_transaction_bson.go
74 lines (65 loc) · 2.08 KB
/
binlog_transaction_bson.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package proto
import (
"bytes"
"github.com/youtube/vitess/go/bson"
"github.com/youtube/vitess/go/bytes2"
)
// DO NOT EDIT.
// FILE GENERATED BY BSONGEN.
// 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)
bson.EncodeString(buf, "TransactionID", binlogTransaction.TransactionID)
lenWriter.Close()
}
// UnmarshalBson bson-decodes into BinlogTransaction.
func (binlogTransaction *BinlogTransaction) UnmarshalBson(buf *bytes.Buffer, kind byte) {
switch kind {
case bson.EOO, bson.Object:
// valid
case bson.Null:
return
default:
panic(bson.NewBsonError("unexpected kind %v for BinlogTransaction", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Statements":
// []Statement
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for binlogTransaction.Statements", kind))
}
bson.Next(buf, 4)
binlogTransaction.Statements = make([]Statement, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 Statement
_v1.UnmarshalBson(buf, kind)
binlogTransaction.Statements = append(binlogTransaction.Statements, _v1)
}
}
case "Timestamp":
binlogTransaction.Timestamp = bson.DecodeInt64(buf, kind)
case "TransactionID":
binlogTransaction.TransactionID = bson.DecodeString(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}