forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 13
/
charset_bson.go
53 lines (44 loc) · 1.28 KB
/
charset_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
// 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 Charset.
func (charset *Charset) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeInt(buf, "Client", charset.Client)
bson.EncodeInt(buf, "Conn", charset.Conn)
bson.EncodeInt(buf, "Server", charset.Server)
lenWriter.Close()
}
// UnmarshalBson bson-decodes into Charset.
func (charset *Charset) 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 Charset", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Client":
charset.Client = bson.DecodeInt(buf, kind)
case "Conn":
charset.Conn = bson.DecodeInt(buf, kind)
case "Server":
charset.Server = bson.DecodeInt(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}