forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 1
/
keyspace_id_bson.go
35 lines (29 loc) · 873 Bytes
/
keyspace_id_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
// 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 key
// DO NOT EDIT.
// FILE GENERATED BY BSONGEN.
import (
"bytes"
"github.com/youtube/vitess/go/bson"
"github.com/youtube/vitess/go/bytes2"
)
// MarshalBson bson-encodes KeyspaceId.
func (keyspaceId KeyspaceId) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
if key == "" {
lenWriter := bson.NewLenWriter(buf)
defer lenWriter.Close()
key = bson.MAGICTAG
}
bson.EncodeString(buf, key, string(keyspaceId))
}
// UnmarshalBson bson-decodes into KeyspaceId.
func (keyspaceId *KeyspaceId) UnmarshalBson(buf *bytes.Buffer, kind byte) {
if kind == bson.EOO {
bson.Next(buf, 4)
kind = bson.NextByte(buf)
bson.ReadCString(buf)
}
*keyspaceId = KeyspaceId(bson.DecodeString(buf, kind))
}