1
2
3
4 package sortkeys
5
6 import (
7 bytes "bytes"
8 fmt "fmt"
9 _ "github.com/gogo/protobuf/gogoproto"
10 proto "github.com/gogo/protobuf/proto"
11 math "math"
12 reflect "reflect"
13 strings "strings"
14 )
15
16
17 var _ = proto.Marshal
18 var _ = fmt.Errorf
19 var _ = math.Inf
20
21
22
23
24
25 const _ = proto.GoGoProtoPackageIsVersion3
26
27 type Object struct {
28 XXX_NoUnkeyedLiteral struct{} `json:"-"`
29 XXX_unrecognized []byte `json:"-"`
30 XXX_sizecache int32 `json:"-"`
31 }
32
33 func (m *Object) Reset() { *m = Object{} }
34 func (m *Object) String() string { return proto.CompactTextString(m) }
35 func (*Object) ProtoMessage() {}
36 func (*Object) Descriptor() ([]byte, []int) {
37 return fileDescriptor_facf4ffffcc1013f, []int{0}
38 }
39 func (m *Object) XXX_Unmarshal(b []byte) error {
40 return xxx_messageInfo_Object.Unmarshal(m, b)
41 }
42 func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
43 return xxx_messageInfo_Object.Marshal(b, m, deterministic)
44 }
45 func (m *Object) XXX_Merge(src proto.Message) {
46 xxx_messageInfo_Object.Merge(m, src)
47 }
48 func (m *Object) XXX_Size() int {
49 return xxx_messageInfo_Object.Size(m)
50 }
51 func (m *Object) XXX_DiscardUnknown() {
52 xxx_messageInfo_Object.DiscardUnknown(m)
53 }
54
55 var xxx_messageInfo_Object proto.InternalMessageInfo
56
57 func init() {
58 proto.RegisterType((*Object)(nil), "sortkeys.Object")
59 }
60
61 func init() { proto.RegisterFile("sortkeys/sortable.proto", fileDescriptor_facf4ffffcc1013f) }
62
63 var fileDescriptor_facf4ffffcc1013f = []byte{
64
65 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2f, 0xce, 0x2f, 0x2a,
66 0xc9, 0x4e, 0xad, 0x2c, 0xd6, 0x07, 0x31, 0x12, 0x93, 0x72, 0x52, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b,
67 0xf2, 0x85, 0x38, 0x60, 0x12, 0x52, 0xba, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9,
68 0xb9, 0xfa, 0xe9, 0xf9, 0xe9, 0xf9, 0xfa, 0x60, 0x05, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03,
69 0x66, 0x41, 0x34, 0x2a, 0x71, 0x70, 0xb1, 0xf9, 0x27, 0x65, 0xa5, 0x26, 0x97, 0x38, 0x09, 0x7c,
70 0x78, 0x28, 0xc7, 0xf8, 0xe3, 0xa1, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x3b, 0x1e, 0xc9, 0x31,
71 0x26, 0xb1, 0x81, 0x95, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd5, 0x1b, 0xba, 0xd6, 0x76,
72 0x00, 0x00, 0x00,
73 }
74
75 func (this *Object) Equal(that interface{}) bool {
76 if that == nil {
77 return this == nil
78 }
79
80 that1, ok := that.(*Object)
81 if !ok {
82 that2, ok := that.(Object)
83 if ok {
84 that1 = &that2
85 } else {
86 return false
87 }
88 }
89 if that1 == nil {
90 return this == nil
91 } else if this == nil {
92 return false
93 }
94 if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
95 return false
96 }
97 return true
98 }
99 func (this *Object) GoString() string {
100 if this == nil {
101 return "nil"
102 }
103 s := make([]string, 0, 4)
104 s = append(s, "&sortkeys.Object{")
105 if this.XXX_unrecognized != nil {
106 s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
107 }
108 s = append(s, "}")
109 return strings.Join(s, "")
110 }
111 func valueToGoStringSortable(v interface{}, typ string) string {
112 rv := reflect.ValueOf(v)
113 if rv.IsNil() {
114 return "nil"
115 }
116 pv := reflect.Indirect(rv).Interface()
117 return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
118 }
119 func NewPopulatedObject(r randySortable, easy bool) *Object {
120 this := &Object{}
121 if !easy && r.Intn(10) != 0 {
122 this.XXX_unrecognized = randUnrecognizedSortable(r, 1)
123 }
124 return this
125 }
126
127 type randySortable interface {
128 Float32() float32
129 Float64() float64
130 Int63() int64
131 Int31() int32
132 Uint32() uint32
133 Intn(n int) int
134 }
135
136 func randUTF8RuneSortable(r randySortable) rune {
137 ru := r.Intn(62)
138 if ru < 10 {
139 return rune(ru + 48)
140 } else if ru < 36 {
141 return rune(ru + 55)
142 }
143 return rune(ru + 61)
144 }
145 func randStringSortable(r randySortable) string {
146 v1 := r.Intn(100)
147 tmps := make([]rune, v1)
148 for i := 0; i < v1; i++ {
149 tmps[i] = randUTF8RuneSortable(r)
150 }
151 return string(tmps)
152 }
153 func randUnrecognizedSortable(r randySortable, maxFieldNumber int) (dAtA []byte) {
154 l := r.Intn(5)
155 for i := 0; i < l; i++ {
156 wire := r.Intn(4)
157 if wire == 3 {
158 wire = 5
159 }
160 fieldNumber := maxFieldNumber + r.Intn(100)
161 dAtA = randFieldSortable(dAtA, r, fieldNumber, wire)
162 }
163 return dAtA
164 }
165 func randFieldSortable(dAtA []byte, r randySortable, fieldNumber int, wire int) []byte {
166 key := uint32(fieldNumber)<<3 | uint32(wire)
167 switch wire {
168 case 0:
169 dAtA = encodeVarintPopulateSortable(dAtA, uint64(key))
170 v2 := r.Int63()
171 if r.Intn(2) == 0 {
172 v2 *= -1
173 }
174 dAtA = encodeVarintPopulateSortable(dAtA, uint64(v2))
175 case 1:
176 dAtA = encodeVarintPopulateSortable(dAtA, uint64(key))
177 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
178 case 2:
179 dAtA = encodeVarintPopulateSortable(dAtA, uint64(key))
180 ll := r.Intn(100)
181 dAtA = encodeVarintPopulateSortable(dAtA, uint64(ll))
182 for j := 0; j < ll; j++ {
183 dAtA = append(dAtA, byte(r.Intn(256)))
184 }
185 default:
186 dAtA = encodeVarintPopulateSortable(dAtA, uint64(key))
187 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
188 }
189 return dAtA
190 }
191 func encodeVarintPopulateSortable(dAtA []byte, v uint64) []byte {
192 for v >= 1<<7 {
193 dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
194 v >>= 7
195 }
196 dAtA = append(dAtA, uint8(v))
197 return dAtA
198 }
199
View as plain text