mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
added vendors
This commit is contained in:
252
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/bug_test.go
generated
vendored
Normal file
252
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/bug_test.go
generated
vendored
Normal file
@ -0,0 +1,252 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
//http://code.google.com/p/goprotobuf/issues/detail?id=39
|
||||
func TestBugUint32VarintSize(t *testing.T) {
|
||||
temp := uint32(math.MaxUint32)
|
||||
n := &NinOptNative{}
|
||||
n.Field5 = &temp
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != 6 {
|
||||
t.Fatalf("data should be length 6, but its %#v", data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBugZeroLengthSliceSize(t *testing.T) {
|
||||
n := &NinRepPackedNative{
|
||||
Field8: []int64{},
|
||||
}
|
||||
size := n.Size()
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != size {
|
||||
t.Fatalf("expected %v, but got %v", len(data), size)
|
||||
}
|
||||
}
|
||||
|
||||
//http://code.google.com/p/goprotobuf/issues/detail?id=40
|
||||
func TestBugPackedProtoSize(t *testing.T) {
|
||||
n := &NinRepPackedNative{
|
||||
Field4: []int64{172960727389894724, 2360337516664475010, 860833876131988189, 9068073014890763245, 7794843386260381831, 4023536436053141786, 8992311247496919020, 4330096163611305776, 4490411416244976467, 7873947349172707443, 2754969595834279669, 1360667855926938684, 4771480785172657389, 4875578924966668055, 8070579869808877481, 9128179594766551001, 4630419407064527516, 863844540220372892, 8208727650143073487, 7086117356301045838, 7779695211931506151, 5493835345187563535, 9119767633370806007, 9054342025895349248, 1887303228838508438, 7624573031734528281, 1874668389749611225, 3517684643468970593, 6677697606628877758, 7293473953189936168, 444475066704085538, 8594971141363049302, 1146643249094989673, 733393306232853371, 7721178528893916886, 7784452000911004429, 6436373110242711440, 6897422461738321237, 8772249155667732778, 6211871464311393541, 3061903718310406883, 7845488913176136641, 8342255034663902574, 3443058984649725748, 8410801047334832902, 7496541071517841153, 4305416923521577765, 7814967600020476457, 8671843803465481186, 3490266370361096855, 1447425664719091336, 653218597262334239, 8306243902880091940, 7851896059762409081, 5936760560798954978, 5755724498441478025, 7022701569985035966, 3707709584811468220, 529069456924666920, 7986469043681522462, 3092513330689518836, 5103541550470476202, 3577384161242626406, 3733428084624703294, 8388690542440473117, 3262468785346149388, 8788358556558007570, 5476276940198542020, 7277903243119461239, 5065861426928605020, 7533460976202697734, 1749213838654236956, 557497603941617931, 5496307611456481108, 6444547750062831720, 6992758776744205596, 7356719693428537399, 2896328872476734507, 381447079530132038, 598300737753233118, 3687980626612697715, 7240924191084283349, 8172414415307971170, 4847024388701257185, 2081764168600256551, 3394217778539123488, 6244660626429310923, 8301712215675381614, 5360615125359461174, 8410140945829785773, 3152963269026381373, 6197275282781459633, 4419829061407546410, 6262035523070047537, 2837207483933463885, 2158105736666826128, 8150764172235490711},
|
||||
Field7: []int32{249451845, 1409974015, 393609128, 435232428, 1817529040, 91769006, 861170933, 1556185603, 1568580279, 1236375273, 512276621, 693633711, 967580535, 1950715977, 853431462, 1362390253, 159591204, 111900629, 322985263, 279671129, 1592548430, 465651370, 733849989, 1172059400, 1574824441, 263541092, 1271612397, 1520584358, 467078791, 117698716, 1098255064, 2054264846, 1766452305, 1267576395, 1557505617, 1187833560, 956187431, 1970977586, 1160235159, 1610259028, 489585797, 459139078, 566263183, 954319278, 1545018565, 1753946743, 948214318, 422878159, 883926576, 1424009347, 824732372, 1290433180, 80297942, 417294230, 1402647904, 2078392782, 220505045, 787368129, 463781454, 293083578, 808156928, 293976361},
|
||||
Field9: []uint32{0xaa4976e8, 0x3da8cc4c, 0x8c470d83, 0x344d964e, 0x5b90925, 0xa4c4d34e, 0x666eff19, 0xc238e552, 0x9be53bb6, 0x56364245, 0x33ee079d, 0x96bf0ede, 0x7941b74f, 0xdb07cb47, 0x6d76d827, 0x9b211d5d, 0x2798adb6, 0xe48b0c3b, 0x87061b21, 0x48f4e4d2, 0x3e5d5c12, 0x5ee91288, 0x336d4f35, 0xe1d44941, 0xc065548d, 0x2953d73f, 0x873af451, 0xfc769db, 0x9f1bf8da, 0x9baafdfc, 0xf1d3d770, 0x5bb5d2b4, 0xc2c67c48, 0x6845c4c1, 0xa48f32b0, 0xbb04bb70, 0xa5b1ca36, 0x8d98356a, 0x2171f654, 0x5ae279b0, 0x6c4a3d6b, 0x4fff5468, 0xcf9bf851, 0x68513614, 0xdbecd9b0, 0x9553ed3c, 0xa494a736, 0x42205438, 0xbf8e5caa, 0xd3283c6, 0x76d20788, 0x9179826f, 0x96b24f85, 0xbc2eacf4, 0xe4afae0b, 0x4bca85cb, 0x35e63b5b, 0xd7ccee0c, 0x2b506bb9, 0xe78e9f44, 0x9ad232f1, 0x99a37335, 0xa5d6ffc8},
|
||||
Field11: []uint64{0x53c01ebc, 0x4fb85ba6, 0x8805eea1, 0xb20ec896, 0x93b63410, 0xec7c9492, 0x50765a28, 0x19592106, 0x2ecc59b3, 0x39cd474f, 0xe4c9e47, 0x444f48c5, 0xe7731d32, 0xf3f43975, 0x603caedd, 0xbb05a1af, 0xa808e34e, 0x88580b07, 0x4c96bbd1, 0x730b4ab9, 0xed126e2b, 0x6db48205, 0x154ba1b9, 0xc26bfb6a, 0x389aa052, 0x869d966c, 0x7c86b366, 0xcc8edbcd, 0xfa8d6dad, 0xcf5857d9, 0x2d9cda0f, 0x1218a0b8, 0x41bf997, 0xf0ca65ac, 0xa610d4b9, 0x8d362e28, 0xb7212d87, 0x8e0fe109, 0xbee041d9, 0x759be2f6, 0x35fef4f3, 0xaeacdb71, 0x10888852, 0xf4e28117, 0xe2a14812, 0x73b748dc, 0xd1c3c6b2, 0xfef41bf0, 0xc9b43b62, 0x810e4faa, 0xcaa41c06, 0x1893fe0d, 0xedc7c850, 0xd12b9eaa, 0x467ee1a9, 0xbe84756b, 0xda7b1680, 0xdc069ffe, 0xf1e7e9f9, 0xb3d95370, 0xa92b77df, 0x5693ac41, 0xd04b7287, 0x27aebf15, 0x837b316e, 0x4dbe2263, 0xbab70c67, 0x547dab21, 0x3c346c1f, 0xb8ef0e4e, 0xfe2d03ce, 0xe1d75955, 0xfec1306, 0xba35c23e, 0xb784ed04, 0x2a4e33aa, 0x7e19d09a, 0x3827c1fe, 0xf3a51561, 0xef765e2b, 0xb044256c, 0x62b322be, 0xf34d56be, 0xeb71b369, 0xffe1294f, 0x237fe8d0, 0x77a1473b, 0x239e1196, 0xdd19bf3d, 0x82c91fe1, 0x95361c57, 0xffea3f1b, 0x1a094c84},
|
||||
Field12: []int64{8308420747267165049, 3664160795077875961, 7868970059161834817, 7237335984251173739, 5254748003907196506, 3362259627111837480, 430460752854552122, 5119635556501066533, 1277716037866233522, 9185775384759813768, 833932430882717888, 7986528304451297640, 6792233378368656337, 2074207091120609721, 1788723326198279432, 7756514594746453657, 2283775964901597324, 3061497730110517191, 7733947890656120277, 626967303632386244, 7822928600388582821, 3489658753000061230, 168869995163005961, 248814782163480763, 477885608911386247, 4198422415674133867, 3379354662797976109, 9925112544736939, 1486335136459138480, 4561560414032850671, 1010864164014091267, 186722821683803084, 5106357936724819318, 1298160820191228988, 4675403242419953145, 7130634540106489752, 7101280006672440929, 7176058292431955718, 9109875054097770321, 6810974877085322872, 4736707874303993641, 8993135362721382187, 6857881554990254283, 3704748883307461680, 1099360832887634994, 5207691918707192633, 5984721695043995243},
|
||||
}
|
||||
size := proto.Size(n)
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != size {
|
||||
t.Fatalf("expected %v, but got %v diff is %v", len(data), size, len(data)-size)
|
||||
}
|
||||
}
|
||||
|
||||
func testSize(m interface {
|
||||
proto.Message
|
||||
Size() int
|
||||
}, desc string, expected int) ([]byte, error) {
|
||||
data, err := proto.Marshal(m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
protoSize := proto.Size(m)
|
||||
mSize := m.Size()
|
||||
lenData := len(data)
|
||||
if protoSize != mSize || protoSize != lenData || mSize != lenData {
|
||||
return nil, fmt.Errorf("%s proto.Size(m){%d} != m.Size(){%d} != len(data){%d}", desc, protoSize, mSize, lenData)
|
||||
}
|
||||
if got := protoSize; got != expected {
|
||||
return nil, fmt.Errorf("%s proto.Size(m) got %d expected %d", desc, got, expected)
|
||||
}
|
||||
if got := mSize; got != expected {
|
||||
return nil, fmt.Errorf("%s m.Size() got %d expected %d", desc, got, expected)
|
||||
}
|
||||
if got := lenData; got != expected {
|
||||
return nil, fmt.Errorf("%s len(data) got %d expected %d", desc, got, expected)
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func TestInt32Int64Compatibility(t *testing.T) {
|
||||
|
||||
//test nullable int32 and int64
|
||||
|
||||
data1, err := testSize(&NinOptNative{
|
||||
Field3: proto.Int32(-1),
|
||||
}, "nullable", 11)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
//change marshaled data1 to unmarshal into 4th field which is an int64
|
||||
data1[0] = uint8(uint32(4 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
u1 := &NinOptNative{}
|
||||
if err = proto.Unmarshal(data1, u1); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !u1.Equal(&NinOptNative{
|
||||
Field4: proto.Int64(-1),
|
||||
}) {
|
||||
t.Error("nullable unmarshaled int32 is not the same int64")
|
||||
}
|
||||
|
||||
//test non-nullable int32 and int64
|
||||
|
||||
data2, err := testSize(&NidOptNative{
|
||||
Field3: -1,
|
||||
}, "non nullable", 67)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
//change marshaled data2 to unmarshal into 4th field which is an int64
|
||||
field3 := uint8(uint32(3 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
field4 := uint8(uint32(4 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
for i, c := range data2 {
|
||||
if c == field4 {
|
||||
data2[i] = field3
|
||||
} else if c == field3 {
|
||||
data2[i] = field4
|
||||
}
|
||||
}
|
||||
u2 := &NidOptNative{}
|
||||
if err = proto.Unmarshal(data2, u2); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !u2.Equal(&NidOptNative{
|
||||
Field4: -1,
|
||||
}) {
|
||||
t.Error("non nullable unmarshaled int32 is not the same int64")
|
||||
}
|
||||
|
||||
//test packed repeated int32 and int64
|
||||
|
||||
m4 := &NinRepPackedNative{
|
||||
Field3: []int32{-1},
|
||||
}
|
||||
data4, err := testSize(m4, "packed", 12)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
u4 := &NinRepPackedNative{}
|
||||
if err := proto.Unmarshal(data4, u4); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := u4.VerboseEqual(m4); err != nil {
|
||||
t.Fatalf("%#v", u4)
|
||||
}
|
||||
|
||||
//test repeated int32 and int64
|
||||
|
||||
if _, err := testSize(&NinRepNative{
|
||||
Field3: []int32{-1},
|
||||
}, "repeated", 11); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
t.Logf("tested all")
|
||||
}
|
||||
|
||||
func TestRepeatedExtensionsMsgsIssue161(t *testing.T) {
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
rep := 10
|
||||
nins := make([]*NinOptNative, rep)
|
||||
for i := range nins {
|
||||
nins[i] = NewPopulatedNinOptNative(r, true)
|
||||
}
|
||||
input := &MyExtendable{}
|
||||
if err := proto.SetExtension(input, E_FieldE, nins); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := proto.Marshal(input)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := &MyExtendable{}
|
||||
if err := proto.Unmarshal(data, output); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !input.Equal(output) {
|
||||
t.Fatalf("want %#v but got %#v", input, output)
|
||||
}
|
||||
data2, err2 := proto.Marshal(output)
|
||||
if err2 != nil {
|
||||
t.Fatal(err2)
|
||||
}
|
||||
if len(data) != len(data2) {
|
||||
t.Fatal("expected equal length buffers")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepeatedExtensionsFieldsIssue161(t *testing.T) {
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
rep := 10
|
||||
ints := make([]int64, rep)
|
||||
for i := range ints {
|
||||
ints[i] = r.Int63()
|
||||
}
|
||||
input := &MyExtendable{}
|
||||
if err := proto.SetExtension(input, E_FieldD, ints); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := proto.Marshal(input)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := &MyExtendable{}
|
||||
if err := proto.Unmarshal(data, output); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !input.Equal(output) {
|
||||
t.Fatalf("want %#v but got %#v", input, output)
|
||||
}
|
||||
data2, err2 := proto.Marshal(output)
|
||||
if err2 != nil {
|
||||
t.Fatal(err2)
|
||||
}
|
||||
if len(data) != len(data2) {
|
||||
t.Fatal("expected equal length buffers")
|
||||
}
|
||||
}
|
73
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/t.go
generated
vendored
Normal file
73
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/t.go
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
type T struct {
|
||||
Data string
|
||||
}
|
||||
|
||||
func (gt *T) protoType() *ProtoType {
|
||||
return &ProtoType{
|
||||
Field2: >.Data,
|
||||
}
|
||||
}
|
||||
|
||||
func (gt T) Equal(other T) bool {
|
||||
return gt.protoType().Equal(other.protoType())
|
||||
}
|
||||
|
||||
func (gt *T) Size() int {
|
||||
proto := &ProtoType{
|
||||
Field2: >.Data,
|
||||
}
|
||||
return proto.Size()
|
||||
}
|
||||
|
||||
func NewPopulatedT(r randyThetest) *T {
|
||||
data := NewPopulatedProtoType(r, false).Field2
|
||||
gt := &T{}
|
||||
if data != nil {
|
||||
gt.Data = *data
|
||||
}
|
||||
return gt
|
||||
}
|
||||
|
||||
func (r T) Marshal() ([]byte, error) {
|
||||
return proto.Marshal(r.protoType())
|
||||
}
|
||||
|
||||
func (r *T) Unmarshal(data []byte) error {
|
||||
pr := &ProtoType{}
|
||||
err := proto.Unmarshal(data, pr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if pr.Field2 != nil {
|
||||
r.Data = *pr.Field2
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gt T) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(gt.Data)
|
||||
}
|
||||
|
||||
func (gt *T) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
err := json.Unmarshal(data, &s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*gt = T{Data: s}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gt T) Compare(other T) int {
|
||||
return strings.Compare(gt.Data, other.Data)
|
||||
}
|
41441
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/thetest.pb.go
generated
vendored
Normal file
41441
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/thetest.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
649
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/thetest.proto
generated
vendored
Normal file
649
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/thetest.proto
generated
vendored
Normal file
@ -0,0 +1,649 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package test;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.description_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.marshaler_all) = false;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
option (gogoproto.protosizer_all) = false;
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
option (gogoproto.unsafe_marshaler_all) = false;
|
||||
option (gogoproto.unsafe_unmarshaler_all) = false;
|
||||
|
||||
option (gogoproto.compare_all) = true;
|
||||
|
||||
message NidOptNative {
|
||||
optional double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
optional float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
optional int32 Field3 = 3 [(gogoproto.nullable) = false];
|
||||
optional int64 Field4 = 4 [(gogoproto.nullable) = false];
|
||||
optional uint32 Field5 = 5 [(gogoproto.nullable) = false];
|
||||
optional uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
optional sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
optional sint64 Field8 = 8 [(gogoproto.nullable) = false];
|
||||
optional fixed32 Field9 = 9 [(gogoproto.nullable) = false];
|
||||
optional sfixed32 Field10 = 10 [(gogoproto.nullable) = false];
|
||||
optional fixed64 Field11 = 11 [(gogoproto.nullable) = false];
|
||||
optional sfixed64 Field12 = 12 [(gogoproto.nullable) = false];
|
||||
optional bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
optional string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
optional bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptNative {
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional int32 Field3 = 3;
|
||||
optional int64 Field4 = 4;
|
||||
optional uint32 Field5 = 5;
|
||||
optional uint64 Field6 = 6;
|
||||
optional sint32 Field7 = 7;
|
||||
optional sint64 Field8 = 8;
|
||||
optional fixed32 Field9 = 9;
|
||||
optional sfixed32 Field10 = 10;
|
||||
optional fixed64 Field11 = 11;
|
||||
optional sfixed64 Field12 = 12;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidRepNative {
|
||||
repeated double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
repeated int32 Field3 = 3 [(gogoproto.nullable) = false];
|
||||
repeated int64 Field4 = 4 [(gogoproto.nullable) = false];
|
||||
repeated uint32 Field5 = 5 [(gogoproto.nullable) = false];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
repeated sint64 Field8 = 8 [(gogoproto.nullable) = false];
|
||||
repeated fixed32 Field9 = 9 [(gogoproto.nullable) = false];
|
||||
repeated sfixed32 Field10 = 10 [(gogoproto.nullable) = false];
|
||||
repeated fixed64 Field11 = 11 [(gogoproto.nullable) = false];
|
||||
repeated sfixed64 Field12 = 12 [(gogoproto.nullable) = false];
|
||||
repeated bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
repeated string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
repeated bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepNative {
|
||||
repeated double Field1 = 1;
|
||||
repeated float Field2 = 2;
|
||||
repeated int32 Field3 = 3;
|
||||
repeated int64 Field4 = 4;
|
||||
repeated uint32 Field5 = 5;
|
||||
repeated uint64 Field6 = 6;
|
||||
repeated sint32 Field7 = 7;
|
||||
repeated sint64 Field8 = 8;
|
||||
repeated fixed32 Field9 = 9;
|
||||
repeated sfixed32 Field10 = 10;
|
||||
repeated fixed64 Field11 = 11;
|
||||
repeated sfixed64 Field12 = 12;
|
||||
repeated bool Field13 = 13;
|
||||
repeated string Field14 = 14;
|
||||
repeated bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidRepPackedNative {
|
||||
repeated double Field1 = 1 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated float Field2 = 2 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated int32 Field3 = 3 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated int64 Field4 = 4 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated uint32 Field5 = 5 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sint64 Field8 = 8 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated fixed32 Field9 = 9 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sfixed32 Field10 = 10 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated fixed64 Field11 = 11 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sfixed64 Field12 = 12 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated bool Field13 = 13 [(gogoproto.nullable) = false, packed = true];
|
||||
}
|
||||
|
||||
message NinRepPackedNative {
|
||||
repeated double Field1 = 1 [packed = true];
|
||||
repeated float Field2 = 2 [packed = true];
|
||||
repeated int32 Field3 = 3 [packed = true];
|
||||
repeated int64 Field4 = 4 [packed = true];
|
||||
repeated uint32 Field5 = 5 [packed = true];
|
||||
repeated uint64 Field6 = 6 [packed = true];
|
||||
repeated sint32 Field7 = 7 [packed = true];
|
||||
repeated sint64 Field8 = 8 [packed = true];
|
||||
repeated fixed32 Field9 = 9 [packed = true];
|
||||
repeated sfixed32 Field10 = 10 [packed = true];
|
||||
repeated fixed64 Field11 = 11 [packed = true];
|
||||
repeated sfixed64 Field12 = 12 [packed = true];
|
||||
repeated bool Field13 = 13 [packed = true];
|
||||
}
|
||||
|
||||
message NidOptStruct {
|
||||
optional double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
optional float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
optional NidOptNative Field3 = 3 [(gogoproto.nullable) = false];
|
||||
optional NinOptNative Field4 = 4 [(gogoproto.nullable) = false];
|
||||
optional uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
optional sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
optional NidOptNative Field8 = 8 [(gogoproto.nullable) = false];
|
||||
optional bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
optional string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
optional bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptStruct {
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional NidOptNative Field3 = 3;
|
||||
optional NinOptNative Field4 = 4;
|
||||
optional uint64 Field6 = 6;
|
||||
optional sint32 Field7 = 7;
|
||||
optional NidOptNative Field8 = 8;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidRepStruct {
|
||||
repeated double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
repeated NidOptNative Field3 = 3 [(gogoproto.nullable) = false];
|
||||
repeated NinOptNative Field4 = 4 [(gogoproto.nullable) = false];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
repeated NidOptNative Field8 = 8 [(gogoproto.nullable) = false];
|
||||
repeated bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
repeated string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
repeated bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepStruct {
|
||||
repeated double Field1 = 1;
|
||||
repeated float Field2 = 2;
|
||||
repeated NidOptNative Field3 = 3;
|
||||
repeated NinOptNative Field4 = 4;
|
||||
repeated uint64 Field6 = 6;
|
||||
repeated sint32 Field7 = 7;
|
||||
repeated NidOptNative Field8 = 8;
|
||||
repeated bool Field13 = 13;
|
||||
repeated string Field14 = 14;
|
||||
repeated bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidEmbeddedStruct {
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NidOptNative Field200 = 200 [(gogoproto.nullable) = false];
|
||||
optional bool Field210 = 210 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinEmbeddedStruct {
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NidOptNative Field200 = 200;
|
||||
optional bool Field210 = 210;
|
||||
}
|
||||
|
||||
message NidNestedStruct {
|
||||
optional NidOptStruct Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated NidRepStruct Field2 = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinNestedStruct {
|
||||
optional NinOptStruct Field1 = 1;
|
||||
repeated NinRepStruct Field2 = 2;
|
||||
}
|
||||
|
||||
message NidOptCustom {
|
||||
optional bytes Id = 1 [(gogoproto.customtype) = "Uuid", (gogoproto.nullable) = false];
|
||||
optional bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message CustomDash {
|
||||
optional bytes Value = 1 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom-dash-type.Bytes"];
|
||||
}
|
||||
|
||||
message NinOptCustom {
|
||||
optional bytes Id = 1 [(gogoproto.customtype) = "Uuid"];
|
||||
optional bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
}
|
||||
|
||||
message NidRepCustom {
|
||||
repeated bytes Id = 1 [(gogoproto.customtype) = "Uuid", (gogoproto.nullable) = false];
|
||||
repeated bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepCustom {
|
||||
repeated bytes Id = 1 [(gogoproto.customtype) = "Uuid"];
|
||||
repeated bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
}
|
||||
|
||||
message NinOptNativeUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional int32 Field3 = 3;
|
||||
optional int64 Field4 = 4;
|
||||
optional uint32 Field5 = 5;
|
||||
optional uint64 Field6 = 6;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NinOptStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional NidOptNative Field3 = 3;
|
||||
optional NinOptNative Field4 = 4;
|
||||
optional uint64 Field6 = 6;
|
||||
optional sint32 Field7 = 7;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NinEmbeddedStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NinOptNative Field200 = 200;
|
||||
optional bool Field210 = 210;
|
||||
}
|
||||
|
||||
message NinNestedStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional NinOptNativeUnion Field1 = 1;
|
||||
optional NinOptStructUnion Field2 = 2;
|
||||
optional NinEmbeddedStructUnion Field3 = 3;
|
||||
}
|
||||
|
||||
message Tree {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional OrBranch Or = 1;
|
||||
optional AndBranch And = 2;
|
||||
optional Leaf Leaf = 3;
|
||||
}
|
||||
|
||||
message OrBranch {
|
||||
optional Tree Left = 1 [(gogoproto.nullable) = false];
|
||||
optional Tree Right = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message AndBranch {
|
||||
optional Tree Left = 1 [(gogoproto.nullable) = false];
|
||||
optional Tree Right = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message Leaf {
|
||||
optional int64 Value = 1 [(gogoproto.nullable) = false];
|
||||
optional string StrValue = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message DeepTree {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional ADeepBranch Down = 1;
|
||||
optional AndDeepBranch And = 2;
|
||||
optional DeepLeaf Leaf = 3;
|
||||
}
|
||||
|
||||
message ADeepBranch {
|
||||
optional DeepTree Down = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message AndDeepBranch {
|
||||
optional DeepTree Left = 1 [(gogoproto.nullable) = false];
|
||||
optional DeepTree Right = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message DeepLeaf {
|
||||
optional Tree Tree = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message Nil {
|
||||
|
||||
}
|
||||
|
||||
enum TheTestEnum {
|
||||
A = 0;
|
||||
B = 1;
|
||||
C = 2;
|
||||
}
|
||||
|
||||
enum AnotherTestEnum {
|
||||
option (gogoproto.goproto_enum_prefix) = false;
|
||||
D = 10;
|
||||
E = 11;
|
||||
}
|
||||
|
||||
// YetAnotherTestEnum is used to test cross-package import of custom name
|
||||
// fields and default resolution.
|
||||
enum YetAnotherTestEnum {
|
||||
option (gogoproto.goproto_enum_prefix) = false;
|
||||
AA = 0;
|
||||
BB = 1 [(gogoproto.enumvalue_customname) = "BetterYetBB"];
|
||||
}
|
||||
|
||||
// YetAnotherTestEnum is used to test cross-package import of custom name
|
||||
// fields and default resolution.
|
||||
enum YetYetAnotherTestEnum {
|
||||
option (gogoproto.goproto_enum_prefix) = true;
|
||||
CC = 0;
|
||||
DD = 1 [(gogoproto.enumvalue_customname) = "BetterYetDD"];
|
||||
}
|
||||
|
||||
message NidOptEnum {
|
||||
optional TheTestEnum Field1 = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptEnum {
|
||||
optional TheTestEnum Field1 = 1;
|
||||
optional YetAnotherTestEnum Field2 = 2;
|
||||
optional YetYetAnotherTestEnum Field3 = 3;
|
||||
}
|
||||
|
||||
message NidRepEnum {
|
||||
repeated TheTestEnum Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated YetAnotherTestEnum Field2 = 2 [(gogoproto.nullable) = false];
|
||||
repeated YetYetAnotherTestEnum Field3 = 3 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepEnum {
|
||||
repeated TheTestEnum Field1 = 1;
|
||||
repeated YetAnotherTestEnum Field2 = 2;
|
||||
repeated YetYetAnotherTestEnum Field3 = 3;
|
||||
}
|
||||
|
||||
message NinOptEnumDefault {
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
option (gogoproto.face) = false;
|
||||
optional TheTestEnum Field1 = 1 [default=C];
|
||||
optional YetAnotherTestEnum Field2 = 2 [default=BB];
|
||||
optional YetYetAnotherTestEnum Field3 = 3 [default=CC];
|
||||
}
|
||||
|
||||
message AnotherNinOptEnum {
|
||||
optional AnotherTestEnum Field1 = 1;
|
||||
optional YetAnotherTestEnum Field2 = 2;
|
||||
optional YetYetAnotherTestEnum Field3 = 3;
|
||||
}
|
||||
|
||||
message AnotherNinOptEnumDefault {
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
option (gogoproto.face) = false;
|
||||
optional AnotherTestEnum Field1 = 1 [default=E];
|
||||
optional YetAnotherTestEnum Field2 = 2 [default=BB];
|
||||
optional YetYetAnotherTestEnum Field3 = 3 [default=CC];
|
||||
}
|
||||
|
||||
|
||||
message Timer {
|
||||
optional sfixed64 Time1 = 1 [(gogoproto.nullable) = false];
|
||||
optional sfixed64 Time2 = 2 [(gogoproto.nullable) = false];
|
||||
optional bytes Data = 3 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message MyExtendable {
|
||||
option (gogoproto.face) = false;
|
||||
optional int64 Field1 = 1;
|
||||
extensions 100 to 199;
|
||||
}
|
||||
|
||||
extend MyExtendable {
|
||||
optional double FieldA = 100;
|
||||
optional NinOptNative FieldB = 101;
|
||||
optional NinEmbeddedStruct FieldC = 102;
|
||||
repeated int64 FieldD = 104;
|
||||
repeated NinOptNative FieldE = 105;
|
||||
}
|
||||
|
||||
message OtherExtenable {
|
||||
option (gogoproto.face) = false;
|
||||
optional int64 Field2 = 2;
|
||||
extensions 14 to 16;
|
||||
optional int64 Field13 = 13;
|
||||
extensions 10 to 12;
|
||||
optional MyExtendable M = 1;
|
||||
}
|
||||
|
||||
message NestedDefinition {
|
||||
optional int64 Field1 = 1;
|
||||
message NestedMessage {
|
||||
optional fixed64 NestedField1 = 1;
|
||||
optional NestedNestedMsg NNM = 2;
|
||||
message NestedNestedMsg {
|
||||
optional string NestedNestedField1 = 10;
|
||||
}
|
||||
}
|
||||
enum NestedEnum {
|
||||
TYPE_NESTED = 1;
|
||||
}
|
||||
optional NestedEnum EnumField = 2;
|
||||
optional NestedMessage.NestedNestedMsg NNM = 3;
|
||||
optional NestedMessage NM = 4;
|
||||
}
|
||||
|
||||
message NestedScope {
|
||||
optional NestedDefinition.NestedMessage.NestedNestedMsg A = 1;
|
||||
optional NestedDefinition.NestedEnum B = 2;
|
||||
optional NestedDefinition.NestedMessage C = 3;
|
||||
}
|
||||
|
||||
message NinOptNativeDefault {
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
option (gogoproto.face) = false;
|
||||
optional double Field1 = 1 [default = 1234.1234];
|
||||
optional float Field2 = 2 [default = 1234.1234];
|
||||
optional int32 Field3 = 3 [default = 1234];
|
||||
optional int64 Field4 = 4 [default = 1234];
|
||||
optional uint32 Field5 = 5 [default = 1234];
|
||||
optional uint64 Field6 = 6 [default = 1234];
|
||||
optional sint32 Field7 = 7 [default = 1234];
|
||||
optional sint64 Field8 = 8 [default = 1234];
|
||||
optional fixed32 Field9 = 9 [default = 1234];
|
||||
optional sfixed32 Field10 = 10 [default = 1234];
|
||||
optional fixed64 Field11 = 11 [default = 1234];
|
||||
optional sfixed64 Field12 = 12 [default = 1234];
|
||||
optional bool Field13 = 13 [default = true];
|
||||
optional string Field14 = 14 [default = "1234"];
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message CustomContainer {
|
||||
optional NidOptCustom CustomStruct = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message CustomNameNidOptNative {
|
||||
optional double Field1 = 1 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldA"];
|
||||
optional float Field2 = 2 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldB"];
|
||||
optional int32 Field3 = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldC"];
|
||||
optional int64 Field4 = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldD"];
|
||||
optional uint32 Field5 = 5 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldE"];
|
||||
optional uint64 Field6 = 6 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldF"];
|
||||
optional sint32 Field7 = 7 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldG"];
|
||||
optional sint64 Field8 = 8 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldH"];
|
||||
optional fixed32 Field9 = 9 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldI"];
|
||||
optional sfixed32 Field10 = 10 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldJ"];
|
||||
optional fixed64 Field11 = 11 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldK"];
|
||||
optional sfixed64 Field12 = 12 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldL"];
|
||||
optional bool Field13 = 13 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldM"];
|
||||
optional string Field14 = 14 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldN"];
|
||||
optional bytes Field15 = 15 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldO"];
|
||||
}
|
||||
|
||||
message CustomNameNinOptNative {
|
||||
optional double Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
optional float Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
optional int32 Field3 = 3 [(gogoproto.customname) = "FieldC"];
|
||||
optional int64 Field4 = 4 [(gogoproto.customname) = "FieldD"];
|
||||
optional uint32 Field5 = 5 [(gogoproto.customname) = "FieldE"];
|
||||
optional uint64 Field6 = 6 [(gogoproto.customname) = "FieldF"];
|
||||
optional sint32 Field7 = 7 [(gogoproto.customname) = "FieldG"];
|
||||
optional sint64 Field8 = 8 [(gogoproto.customname) = "FieldH"];
|
||||
optional fixed32 Field9 = 9 [(gogoproto.customname) = "FieldI"];
|
||||
optional sfixed32 Field10 = 10 [(gogoproto.customname) = "FieldJ"];
|
||||
optional fixed64 Field11 = 11 [(gogoproto.customname) = "FieldK"];
|
||||
optional sfixed64 Field12 = 12 [(gogoproto.customname) = "FielL"];
|
||||
optional bool Field13 = 13 [(gogoproto.customname) = "FieldM"];
|
||||
optional string Field14 = 14 [(gogoproto.customname) = "FieldN"];
|
||||
optional bytes Field15 = 15 [(gogoproto.customname) = "FieldO"];
|
||||
}
|
||||
|
||||
message CustomNameNinRepNative {
|
||||
repeated double Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
repeated float Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
repeated int32 Field3 = 3 [(gogoproto.customname) = "FieldC"];
|
||||
repeated int64 Field4 = 4 [(gogoproto.customname) = "FieldD"];
|
||||
repeated uint32 Field5 = 5 [(gogoproto.customname) = "FieldE"];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.customname) = "FieldF"];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.customname) = "FieldG"];
|
||||
repeated sint64 Field8 = 8 [(gogoproto.customname) = "FieldH"];
|
||||
repeated fixed32 Field9 = 9 [(gogoproto.customname) = "FieldI"];
|
||||
repeated sfixed32 Field10 = 10 [(gogoproto.customname) = "FieldJ"];
|
||||
repeated fixed64 Field11 = 11 [(gogoproto.customname) = "FieldK"];
|
||||
repeated sfixed64 Field12 = 12 [(gogoproto.customname) = "FieldL"];
|
||||
repeated bool Field13 = 13 [(gogoproto.customname) = "FieldM"];
|
||||
repeated string Field14 = 14 [(gogoproto.customname) = "FieldN"];
|
||||
repeated bytes Field15 = 15 [(gogoproto.customname) = "FieldO"];
|
||||
}
|
||||
|
||||
message CustomNameNinStruct {
|
||||
optional double Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
optional float Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
optional NidOptNative Field3 = 3 [(gogoproto.customname) = "FieldC"];
|
||||
repeated NinOptNative Field4 = 4 [(gogoproto.customname) = "FieldD"];
|
||||
optional uint64 Field6 = 6 [(gogoproto.customname) = "FieldE"];
|
||||
optional sint32 Field7 = 7 [(gogoproto.customname) = "FieldF"];
|
||||
optional NidOptNative Field8 = 8 [(gogoproto.customname) = "FieldG"];
|
||||
optional bool Field13 = 13 [(gogoproto.customname) = "FieldH"];
|
||||
optional string Field14 = 14 [(gogoproto.customname) = "FieldI"];
|
||||
optional bytes Field15 = 15 [(gogoproto.customname) = "FieldJ"];
|
||||
}
|
||||
|
||||
message CustomNameCustomType {
|
||||
optional bytes Id = 1 [(gogoproto.customname) = "FieldA", (gogoproto.customtype) = "Uuid"];
|
||||
optional bytes Value = 2 [(gogoproto.customname) = "FieldB", (gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
repeated bytes Ids = 3 [(gogoproto.customname) = "FieldC", (gogoproto.customtype) = "Uuid"];
|
||||
repeated bytes Values = 4 [(gogoproto.customname) = "FieldD", (gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
}
|
||||
|
||||
message CustomNameNinEmbeddedStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NinOptNative Field200 = 200 [(gogoproto.customname) = "FieldA"];
|
||||
optional bool Field210 = 210 [(gogoproto.customname) = "FieldB"];
|
||||
}
|
||||
|
||||
message CustomNameEnum {
|
||||
optional TheTestEnum Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
repeated TheTestEnum Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
}
|
||||
|
||||
message NoExtensionsMap {
|
||||
option (gogoproto.face) = false;
|
||||
option (gogoproto.goproto_extensions_map) = false;
|
||||
optional int64 Field1 = 1;
|
||||
extensions 100 to 199;
|
||||
}
|
||||
|
||||
extend NoExtensionsMap {
|
||||
optional double FieldA1 = 100;
|
||||
optional NinOptNative FieldB1 = 101;
|
||||
optional NinEmbeddedStruct FieldC1 = 102;
|
||||
}
|
||||
|
||||
message Unrecognized {
|
||||
option (gogoproto.goproto_unrecognized) = false;
|
||||
optional string Field1 = 1;
|
||||
}
|
||||
|
||||
message UnrecognizedWithInner {
|
||||
message Inner {
|
||||
option (gogoproto.goproto_unrecognized) = false;
|
||||
optional uint32 Field1 = 1;
|
||||
}
|
||||
|
||||
repeated Inner embedded = 1;
|
||||
optional string Field2 = 2;
|
||||
}
|
||||
|
||||
message UnrecognizedWithEmbed {
|
||||
message Embedded {
|
||||
option (gogoproto.goproto_unrecognized) = false;
|
||||
optional uint32 Field1 = 1;
|
||||
}
|
||||
|
||||
optional Embedded embedded = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
|
||||
optional string Field2 = 2;
|
||||
}
|
||||
|
||||
message Node {
|
||||
optional string Label = 1;
|
||||
repeated Node Children = 2;
|
||||
}
|
||||
|
||||
message NonByteCustomType {
|
||||
optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T"];
|
||||
}
|
||||
|
||||
message NidOptNonByteCustomType {
|
||||
optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptNonByteCustomType {
|
||||
optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T"];
|
||||
}
|
||||
|
||||
message NidRepNonByteCustomType {
|
||||
repeated ProtoType Field1 = 1 [(gogoproto.customtype) = "T", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepNonByteCustomType {
|
||||
repeated ProtoType Field1 = 1 [(gogoproto.customtype) = "T"];
|
||||
}
|
||||
|
||||
message ProtoType {
|
||||
optional string Field2 = 1;
|
||||
}
|
15974
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/thetestpb_test.go
generated
vendored
Normal file
15974
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/thetestpb_test.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
137
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/uuid.go
generated
vendored
Normal file
137
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/uuid.go
generated
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
func PutLittleEndianUint64(b []byte, offset int, v uint64) {
|
||||
b[offset] = byte(v)
|
||||
b[offset+1] = byte(v >> 8)
|
||||
b[offset+2] = byte(v >> 16)
|
||||
b[offset+3] = byte(v >> 24)
|
||||
b[offset+4] = byte(v >> 32)
|
||||
b[offset+5] = byte(v >> 40)
|
||||
b[offset+6] = byte(v >> 48)
|
||||
b[offset+7] = byte(v >> 56)
|
||||
}
|
||||
|
||||
type Uuid []byte
|
||||
|
||||
func (uuid Uuid) Bytes() []byte {
|
||||
return uuid
|
||||
}
|
||||
|
||||
func (uuid Uuid) Marshal() ([]byte, error) {
|
||||
if len(uuid) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return []byte(uuid), nil
|
||||
}
|
||||
|
||||
func (uuid Uuid) MarshalTo(data []byte) (n int, err error) {
|
||||
if len(uuid) == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
copy(data, uuid)
|
||||
return 16, nil
|
||||
}
|
||||
|
||||
func (uuid *Uuid) Unmarshal(data []byte) error {
|
||||
if len(data) == 0 {
|
||||
uuid = nil
|
||||
return nil
|
||||
}
|
||||
id := Uuid(make([]byte, 16))
|
||||
copy(id, data)
|
||||
*uuid = id
|
||||
return nil
|
||||
}
|
||||
|
||||
func (uuid *Uuid) Size() int {
|
||||
if uuid == nil {
|
||||
return 0
|
||||
}
|
||||
if len(*uuid) == 0 {
|
||||
return 0
|
||||
}
|
||||
return 16
|
||||
}
|
||||
|
||||
func (uuid Uuid) MarshalJSON() ([]byte, error) {
|
||||
s := hex.EncodeToString([]byte(uuid))
|
||||
return json.Marshal(s)
|
||||
}
|
||||
|
||||
func (uuid *Uuid) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
err := json.Unmarshal(data, &s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d, err := hex.DecodeString(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*uuid = Uuid(d)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (uuid Uuid) Equal(other Uuid) bool {
|
||||
return bytes.Equal(uuid[0:], other[0:])
|
||||
}
|
||||
|
||||
func (uuid Uuid) Compare(other Uuid) int {
|
||||
return bytes.Compare(uuid[0:], other[0:])
|
||||
}
|
||||
|
||||
type int63 interface {
|
||||
Int63() int64
|
||||
}
|
||||
|
||||
func NewPopulatedUuid(r int63) *Uuid {
|
||||
u := RandV4(r)
|
||||
return &u
|
||||
}
|
||||
|
||||
func RandV4(r int63) Uuid {
|
||||
uuid := make(Uuid, 16)
|
||||
uuid.RandV4(r)
|
||||
return uuid
|
||||
}
|
||||
|
||||
func (uuid Uuid) RandV4(r int63) {
|
||||
PutLittleEndianUint64(uuid, 0, uint64(r.Int63()))
|
||||
PutLittleEndianUint64(uuid, 8, uint64(r.Int63()))
|
||||
uuid[6] = (uuid[6] & 0xf) | 0x40
|
||||
uuid[8] = (uuid[8] & 0x3f) | 0x80
|
||||
}
|
Reference in New Issue
Block a user