David K. Bainbridge | bd6b288 | 2021-08-26 13:31:02 +0000 | [diff] [blame] | 1 | // Protocol Buffers - Google's data interchange format |
| 2 | // Copyright 2008 Google Inc. All rights reserved. |
| 3 | // https://developers.google.com/protocol-buffers/ |
| 4 | // |
| 5 | // Redistribution and use in source and binary forms, with or without |
| 6 | // modification, are permitted provided that the following conditions are |
| 7 | // met: |
| 8 | // |
| 9 | // * Redistributions of source code must retain the above copyright |
| 10 | // notice, this list of conditions and the following disclaimer. |
| 11 | // * Redistributions in binary form must reproduce the above |
| 12 | // copyright notice, this list of conditions and the following disclaimer |
| 13 | // in the documentation and/or other materials provided with the |
| 14 | // distribution. |
| 15 | // * Neither the name of Google Inc. nor the names of its |
| 16 | // contributors may be used to endorse or promote products derived from |
| 17 | // this software without specific prior written permission. |
| 18 | // |
| 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | |
| 31 | // Code generated by protoc-gen-go. DO NOT EDIT. |
| 32 | // source: google/protobuf/struct.proto |
| 33 | |
| 34 | // Package structpb contains generated types for google/protobuf/struct.proto. |
| 35 | // |
| 36 | // The messages (i.e., Value, Struct, and ListValue) defined in struct.proto are |
| 37 | // used to represent arbitrary JSON. The Value message represents a JSON value, |
| 38 | // the Struct message represents a JSON object, and the ListValue message |
| 39 | // represents a JSON array. See https://json.org for more information. |
| 40 | // |
| 41 | // The Value, Struct, and ListValue types have generated MarshalJSON and |
| 42 | // UnmarshalJSON methods such that they serialize JSON equivalent to what the |
| 43 | // messages themselves represent. Use of these types with the |
| 44 | // "google.golang.org/protobuf/encoding/protojson" package |
| 45 | // ensures that they will be serialized as their JSON equivalent. |
| 46 | // |
| 47 | // |
| 48 | // Conversion to and from a Go interface |
| 49 | // |
| 50 | // The standard Go "encoding/json" package has functionality to serialize |
| 51 | // arbitrary types to a large degree. The Value.AsInterface, Struct.AsMap, and |
| 52 | // ListValue.AsSlice methods can convert the protobuf message representation into |
| 53 | // a form represented by interface{}, map[string]interface{}, and []interface{}. |
| 54 | // This form can be used with other packages that operate on such data structures |
| 55 | // and also directly with the standard json package. |
| 56 | // |
| 57 | // In order to convert the interface{}, map[string]interface{}, and []interface{} |
| 58 | // forms back as Value, Struct, and ListValue messages, use the NewStruct, |
| 59 | // NewList, and NewValue constructor functions. |
| 60 | // |
| 61 | // |
| 62 | // Example usage |
| 63 | // |
| 64 | // Consider the following example JSON object: |
| 65 | // |
| 66 | // { |
| 67 | // "firstName": "John", |
| 68 | // "lastName": "Smith", |
| 69 | // "isAlive": true, |
| 70 | // "age": 27, |
| 71 | // "address": { |
| 72 | // "streetAddress": "21 2nd Street", |
| 73 | // "city": "New York", |
| 74 | // "state": "NY", |
| 75 | // "postalCode": "10021-3100" |
| 76 | // }, |
| 77 | // "phoneNumbers": [ |
| 78 | // { |
| 79 | // "type": "home", |
| 80 | // "number": "212 555-1234" |
| 81 | // }, |
| 82 | // { |
| 83 | // "type": "office", |
| 84 | // "number": "646 555-4567" |
| 85 | // } |
| 86 | // ], |
| 87 | // "children": [], |
| 88 | // "spouse": null |
| 89 | // } |
| 90 | // |
| 91 | // To construct a Value message representing the above JSON object: |
| 92 | // |
| 93 | // m, err := structpb.NewValue(map[string]interface{}{ |
| 94 | // "firstName": "John", |
| 95 | // "lastName": "Smith", |
| 96 | // "isAlive": true, |
| 97 | // "age": 27, |
| 98 | // "address": map[string]interface{}{ |
| 99 | // "streetAddress": "21 2nd Street", |
| 100 | // "city": "New York", |
| 101 | // "state": "NY", |
| 102 | // "postalCode": "10021-3100", |
| 103 | // }, |
| 104 | // "phoneNumbers": []interface{}{ |
| 105 | // map[string]interface{}{ |
| 106 | // "type": "home", |
| 107 | // "number": "212 555-1234", |
| 108 | // }, |
| 109 | // map[string]interface{}{ |
| 110 | // "type": "office", |
| 111 | // "number": "646 555-4567", |
| 112 | // }, |
| 113 | // }, |
| 114 | // "children": []interface{}{}, |
| 115 | // "spouse": nil, |
| 116 | // }) |
| 117 | // if err != nil { |
| 118 | // ... // handle error |
| 119 | // } |
| 120 | // ... // make use of m as a *structpb.Value |
| 121 | // |
| 122 | package structpb |
| 123 | |
| 124 | import ( |
| 125 | base64 "encoding/base64" |
| 126 | protojson "google.golang.org/protobuf/encoding/protojson" |
| 127 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" |
| 128 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" |
| 129 | math "math" |
| 130 | reflect "reflect" |
| 131 | sync "sync" |
| 132 | utf8 "unicode/utf8" |
| 133 | ) |
| 134 | |
| 135 | // `NullValue` is a singleton enumeration to represent the null value for the |
| 136 | // `Value` type union. |
| 137 | // |
| 138 | // The JSON representation for `NullValue` is JSON `null`. |
| 139 | type NullValue int32 |
| 140 | |
| 141 | const ( |
| 142 | // Null value. |
| 143 | NullValue_NULL_VALUE NullValue = 0 |
| 144 | ) |
| 145 | |
| 146 | // Enum value maps for NullValue. |
| 147 | var ( |
| 148 | NullValue_name = map[int32]string{ |
| 149 | 0: "NULL_VALUE", |
| 150 | } |
| 151 | NullValue_value = map[string]int32{ |
| 152 | "NULL_VALUE": 0, |
| 153 | } |
| 154 | ) |
| 155 | |
| 156 | func (x NullValue) Enum() *NullValue { |
| 157 | p := new(NullValue) |
| 158 | *p = x |
| 159 | return p |
| 160 | } |
| 161 | |
| 162 | func (x NullValue) String() string { |
| 163 | return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) |
| 164 | } |
| 165 | |
| 166 | func (NullValue) Descriptor() protoreflect.EnumDescriptor { |
| 167 | return file_google_protobuf_struct_proto_enumTypes[0].Descriptor() |
| 168 | } |
| 169 | |
| 170 | func (NullValue) Type() protoreflect.EnumType { |
| 171 | return &file_google_protobuf_struct_proto_enumTypes[0] |
| 172 | } |
| 173 | |
| 174 | func (x NullValue) Number() protoreflect.EnumNumber { |
| 175 | return protoreflect.EnumNumber(x) |
| 176 | } |
| 177 | |
| 178 | // Deprecated: Use NullValue.Descriptor instead. |
| 179 | func (NullValue) EnumDescriptor() ([]byte, []int) { |
| 180 | return file_google_protobuf_struct_proto_rawDescGZIP(), []int{0} |
| 181 | } |
| 182 | |
| 183 | // `Struct` represents a structured data value, consisting of fields |
| 184 | // which map to dynamically typed values. In some languages, `Struct` |
| 185 | // might be supported by a native representation. For example, in |
| 186 | // scripting languages like JS a struct is represented as an |
| 187 | // object. The details of that representation are described together |
| 188 | // with the proto support for the language. |
| 189 | // |
| 190 | // The JSON representation for `Struct` is JSON object. |
| 191 | type Struct struct { |
| 192 | state protoimpl.MessageState |
| 193 | sizeCache protoimpl.SizeCache |
| 194 | unknownFields protoimpl.UnknownFields |
| 195 | |
| 196 | // Unordered map of dynamically typed values. |
| 197 | Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` |
| 198 | } |
| 199 | |
| 200 | // NewStruct constructs a Struct from a general-purpose Go map. |
| 201 | // The map keys must be valid UTF-8. |
| 202 | // The map values are converted using NewValue. |
| 203 | func NewStruct(v map[string]interface{}) (*Struct, error) { |
| 204 | x := &Struct{Fields: make(map[string]*Value, len(v))} |
| 205 | for k, v := range v { |
| 206 | if !utf8.ValidString(k) { |
| 207 | return nil, protoimpl.X.NewError("invalid UTF-8 in string: %q", k) |
| 208 | } |
| 209 | var err error |
| 210 | x.Fields[k], err = NewValue(v) |
| 211 | if err != nil { |
| 212 | return nil, err |
| 213 | } |
| 214 | } |
| 215 | return x, nil |
| 216 | } |
| 217 | |
| 218 | // AsMap converts x to a general-purpose Go map. |
| 219 | // The map values are converted by calling Value.AsInterface. |
| 220 | func (x *Struct) AsMap() map[string]interface{} { |
| 221 | vs := make(map[string]interface{}) |
| 222 | for k, v := range x.GetFields() { |
| 223 | vs[k] = v.AsInterface() |
| 224 | } |
| 225 | return vs |
| 226 | } |
| 227 | |
| 228 | func (x *Struct) MarshalJSON() ([]byte, error) { |
| 229 | return protojson.Marshal(x) |
| 230 | } |
| 231 | |
| 232 | func (x *Struct) UnmarshalJSON(b []byte) error { |
| 233 | return protojson.Unmarshal(b, x) |
| 234 | } |
| 235 | |
| 236 | func (x *Struct) Reset() { |
| 237 | *x = Struct{} |
| 238 | if protoimpl.UnsafeEnabled { |
| 239 | mi := &file_google_protobuf_struct_proto_msgTypes[0] |
| 240 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| 241 | ms.StoreMessageInfo(mi) |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | func (x *Struct) String() string { |
| 246 | return protoimpl.X.MessageStringOf(x) |
| 247 | } |
| 248 | |
| 249 | func (*Struct) ProtoMessage() {} |
| 250 | |
| 251 | func (x *Struct) ProtoReflect() protoreflect.Message { |
| 252 | mi := &file_google_protobuf_struct_proto_msgTypes[0] |
| 253 | if protoimpl.UnsafeEnabled && x != nil { |
| 254 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| 255 | if ms.LoadMessageInfo() == nil { |
| 256 | ms.StoreMessageInfo(mi) |
| 257 | } |
| 258 | return ms |
| 259 | } |
| 260 | return mi.MessageOf(x) |
| 261 | } |
| 262 | |
| 263 | // Deprecated: Use Struct.ProtoReflect.Descriptor instead. |
| 264 | func (*Struct) Descriptor() ([]byte, []int) { |
| 265 | return file_google_protobuf_struct_proto_rawDescGZIP(), []int{0} |
| 266 | } |
| 267 | |
| 268 | func (x *Struct) GetFields() map[string]*Value { |
| 269 | if x != nil { |
| 270 | return x.Fields |
| 271 | } |
| 272 | return nil |
| 273 | } |
| 274 | |
| 275 | // `Value` represents a dynamically typed value which can be either |
| 276 | // null, a number, a string, a boolean, a recursive struct value, or a |
| 277 | // list of values. A producer of value is expected to set one of that |
| 278 | // variants, absence of any variant indicates an error. |
| 279 | // |
| 280 | // The JSON representation for `Value` is JSON value. |
| 281 | type Value struct { |
| 282 | state protoimpl.MessageState |
| 283 | sizeCache protoimpl.SizeCache |
| 284 | unknownFields protoimpl.UnknownFields |
| 285 | |
| 286 | // The kind of value. |
| 287 | // |
| 288 | // Types that are assignable to Kind: |
| 289 | // *Value_NullValue |
| 290 | // *Value_NumberValue |
| 291 | // *Value_StringValue |
| 292 | // *Value_BoolValue |
| 293 | // *Value_StructValue |
| 294 | // *Value_ListValue |
| 295 | Kind isValue_Kind `protobuf_oneof:"kind"` |
| 296 | } |
| 297 | |
| 298 | // NewValue constructs a Value from a general-purpose Go interface. |
| 299 | // |
| 300 | // ╔════════════════════════╤════════════════════════════════════════════╗ |
| 301 | // ║ Go type │ Conversion ║ |
| 302 | // ╠════════════════════════╪════════════════════════════════════════════╣ |
| 303 | // ║ nil │ stored as NullValue ║ |
| 304 | // ║ bool │ stored as BoolValue ║ |
| 305 | // ║ int, int32, int64 │ stored as NumberValue ║ |
| 306 | // ║ uint, uint32, uint64 │ stored as NumberValue ║ |
| 307 | // ║ float32, float64 │ stored as NumberValue ║ |
| 308 | // ║ string │ stored as StringValue; must be valid UTF-8 ║ |
| 309 | // ║ []byte │ stored as StringValue; base64-encoded ║ |
| 310 | // ║ map[string]interface{} │ stored as StructValue ║ |
| 311 | // ║ []interface{} │ stored as ListValue ║ |
| 312 | // ╚════════════════════════╧════════════════════════════════════════════╝ |
| 313 | // |
| 314 | // When converting an int64 or uint64 to a NumberValue, numeric precision loss |
| 315 | // is possible since they are stored as a float64. |
| 316 | func NewValue(v interface{}) (*Value, error) { |
| 317 | switch v := v.(type) { |
| 318 | case nil: |
| 319 | return NewNullValue(), nil |
| 320 | case bool: |
| 321 | return NewBoolValue(v), nil |
| 322 | case int: |
| 323 | return NewNumberValue(float64(v)), nil |
| 324 | case int32: |
| 325 | return NewNumberValue(float64(v)), nil |
| 326 | case int64: |
| 327 | return NewNumberValue(float64(v)), nil |
| 328 | case uint: |
| 329 | return NewNumberValue(float64(v)), nil |
| 330 | case uint32: |
| 331 | return NewNumberValue(float64(v)), nil |
| 332 | case uint64: |
| 333 | return NewNumberValue(float64(v)), nil |
| 334 | case float32: |
| 335 | return NewNumberValue(float64(v)), nil |
| 336 | case float64: |
| 337 | return NewNumberValue(float64(v)), nil |
| 338 | case string: |
| 339 | if !utf8.ValidString(v) { |
| 340 | return nil, protoimpl.X.NewError("invalid UTF-8 in string: %q", v) |
| 341 | } |
| 342 | return NewStringValue(v), nil |
| 343 | case []byte: |
| 344 | s := base64.StdEncoding.EncodeToString(v) |
| 345 | return NewStringValue(s), nil |
| 346 | case map[string]interface{}: |
| 347 | v2, err := NewStruct(v) |
| 348 | if err != nil { |
| 349 | return nil, err |
| 350 | } |
| 351 | return NewStructValue(v2), nil |
| 352 | case []interface{}: |
| 353 | v2, err := NewList(v) |
| 354 | if err != nil { |
| 355 | return nil, err |
| 356 | } |
| 357 | return NewListValue(v2), nil |
| 358 | default: |
| 359 | return nil, protoimpl.X.NewError("invalid type: %T", v) |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | // NewNullValue constructs a new null Value. |
| 364 | func NewNullValue() *Value { |
| 365 | return &Value{Kind: &Value_NullValue{NullValue: NullValue_NULL_VALUE}} |
| 366 | } |
| 367 | |
| 368 | // NewBoolValue constructs a new boolean Value. |
| 369 | func NewBoolValue(v bool) *Value { |
| 370 | return &Value{Kind: &Value_BoolValue{BoolValue: v}} |
| 371 | } |
| 372 | |
| 373 | // NewNumberValue constructs a new number Value. |
| 374 | func NewNumberValue(v float64) *Value { |
| 375 | return &Value{Kind: &Value_NumberValue{NumberValue: v}} |
| 376 | } |
| 377 | |
| 378 | // NewStringValue constructs a new string Value. |
| 379 | func NewStringValue(v string) *Value { |
| 380 | return &Value{Kind: &Value_StringValue{StringValue: v}} |
| 381 | } |
| 382 | |
| 383 | // NewStructValue constructs a new struct Value. |
| 384 | func NewStructValue(v *Struct) *Value { |
| 385 | return &Value{Kind: &Value_StructValue{StructValue: v}} |
| 386 | } |
| 387 | |
| 388 | // NewListValue constructs a new list Value. |
| 389 | func NewListValue(v *ListValue) *Value { |
| 390 | return &Value{Kind: &Value_ListValue{ListValue: v}} |
| 391 | } |
| 392 | |
| 393 | // AsInterface converts x to a general-purpose Go interface. |
| 394 | // |
| 395 | // Calling Value.MarshalJSON and "encoding/json".Marshal on this output produce |
| 396 | // semantically equivalent JSON (assuming no errors occur). |
| 397 | // |
| 398 | // Floating-point values (i.e., "NaN", "Infinity", and "-Infinity") are |
| 399 | // converted as strings to remain compatible with MarshalJSON. |
| 400 | func (x *Value) AsInterface() interface{} { |
| 401 | switch v := x.GetKind().(type) { |
| 402 | case *Value_NumberValue: |
| 403 | if v != nil { |
| 404 | switch { |
| 405 | case math.IsNaN(v.NumberValue): |
| 406 | return "NaN" |
| 407 | case math.IsInf(v.NumberValue, +1): |
| 408 | return "Infinity" |
| 409 | case math.IsInf(v.NumberValue, -1): |
| 410 | return "-Infinity" |
| 411 | default: |
| 412 | return v.NumberValue |
| 413 | } |
| 414 | } |
| 415 | case *Value_StringValue: |
| 416 | if v != nil { |
| 417 | return v.StringValue |
| 418 | } |
| 419 | case *Value_BoolValue: |
| 420 | if v != nil { |
| 421 | return v.BoolValue |
| 422 | } |
| 423 | case *Value_StructValue: |
| 424 | if v != nil { |
| 425 | return v.StructValue.AsMap() |
| 426 | } |
| 427 | case *Value_ListValue: |
| 428 | if v != nil { |
| 429 | return v.ListValue.AsSlice() |
| 430 | } |
| 431 | } |
| 432 | return nil |
| 433 | } |
| 434 | |
| 435 | func (x *Value) MarshalJSON() ([]byte, error) { |
| 436 | return protojson.Marshal(x) |
| 437 | } |
| 438 | |
| 439 | func (x *Value) UnmarshalJSON(b []byte) error { |
| 440 | return protojson.Unmarshal(b, x) |
| 441 | } |
| 442 | |
| 443 | func (x *Value) Reset() { |
| 444 | *x = Value{} |
| 445 | if protoimpl.UnsafeEnabled { |
| 446 | mi := &file_google_protobuf_struct_proto_msgTypes[1] |
| 447 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| 448 | ms.StoreMessageInfo(mi) |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | func (x *Value) String() string { |
| 453 | return protoimpl.X.MessageStringOf(x) |
| 454 | } |
| 455 | |
| 456 | func (*Value) ProtoMessage() {} |
| 457 | |
| 458 | func (x *Value) ProtoReflect() protoreflect.Message { |
| 459 | mi := &file_google_protobuf_struct_proto_msgTypes[1] |
| 460 | if protoimpl.UnsafeEnabled && x != nil { |
| 461 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| 462 | if ms.LoadMessageInfo() == nil { |
| 463 | ms.StoreMessageInfo(mi) |
| 464 | } |
| 465 | return ms |
| 466 | } |
| 467 | return mi.MessageOf(x) |
| 468 | } |
| 469 | |
| 470 | // Deprecated: Use Value.ProtoReflect.Descriptor instead. |
| 471 | func (*Value) Descriptor() ([]byte, []int) { |
| 472 | return file_google_protobuf_struct_proto_rawDescGZIP(), []int{1} |
| 473 | } |
| 474 | |
| 475 | func (m *Value) GetKind() isValue_Kind { |
| 476 | if m != nil { |
| 477 | return m.Kind |
| 478 | } |
| 479 | return nil |
| 480 | } |
| 481 | |
| 482 | func (x *Value) GetNullValue() NullValue { |
| 483 | if x, ok := x.GetKind().(*Value_NullValue); ok { |
| 484 | return x.NullValue |
| 485 | } |
| 486 | return NullValue_NULL_VALUE |
| 487 | } |
| 488 | |
| 489 | func (x *Value) GetNumberValue() float64 { |
| 490 | if x, ok := x.GetKind().(*Value_NumberValue); ok { |
| 491 | return x.NumberValue |
| 492 | } |
| 493 | return 0 |
| 494 | } |
| 495 | |
| 496 | func (x *Value) GetStringValue() string { |
| 497 | if x, ok := x.GetKind().(*Value_StringValue); ok { |
| 498 | return x.StringValue |
| 499 | } |
| 500 | return "" |
| 501 | } |
| 502 | |
| 503 | func (x *Value) GetBoolValue() bool { |
| 504 | if x, ok := x.GetKind().(*Value_BoolValue); ok { |
| 505 | return x.BoolValue |
| 506 | } |
| 507 | return false |
| 508 | } |
| 509 | |
| 510 | func (x *Value) GetStructValue() *Struct { |
| 511 | if x, ok := x.GetKind().(*Value_StructValue); ok { |
| 512 | return x.StructValue |
| 513 | } |
| 514 | return nil |
| 515 | } |
| 516 | |
| 517 | func (x *Value) GetListValue() *ListValue { |
| 518 | if x, ok := x.GetKind().(*Value_ListValue); ok { |
| 519 | return x.ListValue |
| 520 | } |
| 521 | return nil |
| 522 | } |
| 523 | |
| 524 | type isValue_Kind interface { |
| 525 | isValue_Kind() |
| 526 | } |
| 527 | |
| 528 | type Value_NullValue struct { |
| 529 | // Represents a null value. |
| 530 | NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"` |
| 531 | } |
| 532 | |
| 533 | type Value_NumberValue struct { |
| 534 | // Represents a double value. |
| 535 | NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"` |
| 536 | } |
| 537 | |
| 538 | type Value_StringValue struct { |
| 539 | // Represents a string value. |
| 540 | StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` |
| 541 | } |
| 542 | |
| 543 | type Value_BoolValue struct { |
| 544 | // Represents a boolean value. |
| 545 | BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` |
| 546 | } |
| 547 | |
| 548 | type Value_StructValue struct { |
| 549 | // Represents a structured value. |
| 550 | StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"` |
| 551 | } |
| 552 | |
| 553 | type Value_ListValue struct { |
| 554 | // Represents a repeated `Value`. |
| 555 | ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof"` |
| 556 | } |
| 557 | |
| 558 | func (*Value_NullValue) isValue_Kind() {} |
| 559 | |
| 560 | func (*Value_NumberValue) isValue_Kind() {} |
| 561 | |
| 562 | func (*Value_StringValue) isValue_Kind() {} |
| 563 | |
| 564 | func (*Value_BoolValue) isValue_Kind() {} |
| 565 | |
| 566 | func (*Value_StructValue) isValue_Kind() {} |
| 567 | |
| 568 | func (*Value_ListValue) isValue_Kind() {} |
| 569 | |
| 570 | // `ListValue` is a wrapper around a repeated field of values. |
| 571 | // |
| 572 | // The JSON representation for `ListValue` is JSON array. |
| 573 | type ListValue struct { |
| 574 | state protoimpl.MessageState |
| 575 | sizeCache protoimpl.SizeCache |
| 576 | unknownFields protoimpl.UnknownFields |
| 577 | |
| 578 | // Repeated field of dynamically typed values. |
| 579 | Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` |
| 580 | } |
| 581 | |
| 582 | // NewList constructs a ListValue from a general-purpose Go slice. |
| 583 | // The slice elements are converted using NewValue. |
| 584 | func NewList(v []interface{}) (*ListValue, error) { |
| 585 | x := &ListValue{Values: make([]*Value, len(v))} |
| 586 | for i, v := range v { |
| 587 | var err error |
| 588 | x.Values[i], err = NewValue(v) |
| 589 | if err != nil { |
| 590 | return nil, err |
| 591 | } |
| 592 | } |
| 593 | return x, nil |
| 594 | } |
| 595 | |
| 596 | // AsSlice converts x to a general-purpose Go slice. |
| 597 | // The slice elements are converted by calling Value.AsInterface. |
| 598 | func (x *ListValue) AsSlice() []interface{} { |
| 599 | vs := make([]interface{}, len(x.GetValues())) |
| 600 | for i, v := range x.GetValues() { |
| 601 | vs[i] = v.AsInterface() |
| 602 | } |
| 603 | return vs |
| 604 | } |
| 605 | |
| 606 | func (x *ListValue) MarshalJSON() ([]byte, error) { |
| 607 | return protojson.Marshal(x) |
| 608 | } |
| 609 | |
| 610 | func (x *ListValue) UnmarshalJSON(b []byte) error { |
| 611 | return protojson.Unmarshal(b, x) |
| 612 | } |
| 613 | |
| 614 | func (x *ListValue) Reset() { |
| 615 | *x = ListValue{} |
| 616 | if protoimpl.UnsafeEnabled { |
| 617 | mi := &file_google_protobuf_struct_proto_msgTypes[2] |
| 618 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| 619 | ms.StoreMessageInfo(mi) |
| 620 | } |
| 621 | } |
| 622 | |
| 623 | func (x *ListValue) String() string { |
| 624 | return protoimpl.X.MessageStringOf(x) |
| 625 | } |
| 626 | |
| 627 | func (*ListValue) ProtoMessage() {} |
| 628 | |
| 629 | func (x *ListValue) ProtoReflect() protoreflect.Message { |
| 630 | mi := &file_google_protobuf_struct_proto_msgTypes[2] |
| 631 | if protoimpl.UnsafeEnabled && x != nil { |
| 632 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| 633 | if ms.LoadMessageInfo() == nil { |
| 634 | ms.StoreMessageInfo(mi) |
| 635 | } |
| 636 | return ms |
| 637 | } |
| 638 | return mi.MessageOf(x) |
| 639 | } |
| 640 | |
| 641 | // Deprecated: Use ListValue.ProtoReflect.Descriptor instead. |
| 642 | func (*ListValue) Descriptor() ([]byte, []int) { |
| 643 | return file_google_protobuf_struct_proto_rawDescGZIP(), []int{2} |
| 644 | } |
| 645 | |
| 646 | func (x *ListValue) GetValues() []*Value { |
| 647 | if x != nil { |
| 648 | return x.Values |
| 649 | } |
| 650 | return nil |
| 651 | } |
| 652 | |
| 653 | var File_google_protobuf_struct_proto protoreflect.FileDescriptor |
| 654 | |
| 655 | var file_google_protobuf_struct_proto_rawDesc = []byte{ |
| 656 | 0x0a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, |
| 657 | 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, |
| 658 | 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, |
| 659 | 0x98, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3b, 0x0a, 0x06, 0x66, 0x69, |
| 660 | 0x65, 0x6c, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, |
| 661 | 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, |
| 662 | 0x75, 0x63, 0x74, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, |
| 663 | 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x1a, 0x51, 0x0a, 0x0b, 0x46, 0x69, 0x65, 0x6c, 0x64, |
| 664 | 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, |
| 665 | 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, |
| 666 | 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, |
| 667 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, |
| 668 | 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb2, 0x02, 0x0a, 0x05, 0x56, |
| 669 | 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x76, 0x61, 0x6c, |
| 670 | 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, |
| 671 | 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x56, |
| 672 | 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, |
| 673 | 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, |
| 674 | 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x62, 0x65, |
| 675 | 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, |
| 676 | 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, |
| 677 | 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62, |
| 678 | 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, |
| 679 | 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0c, |
| 680 | 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, |
| 681 | 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, |
| 682 | 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x73, |
| 683 | 0x74, 0x72, 0x75, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6c, 0x69, |
| 684 | 0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, |
| 685 | 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, |
| 686 | 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6c, 0x69, |
| 687 | 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, |
| 688 | 0x3b, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2e, 0x0a, 0x06, |
| 689 | 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, |
| 690 | 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, |
| 691 | 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2a, 0x1b, 0x0a, 0x09, |
| 692 | 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x55, 0x4c, |
| 693 | 0x4c, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x00, 0x42, 0x7f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, |
| 694 | 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, |
| 695 | 0x42, 0x0b, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, |
| 696 | 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, |
| 697 | 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, |
| 698 | 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x70, 0x62, |
| 699 | 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, |
| 700 | 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, |
| 701 | 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, |
| 702 | 0x6f, 0x33, |
| 703 | } |
| 704 | |
| 705 | var ( |
| 706 | file_google_protobuf_struct_proto_rawDescOnce sync.Once |
| 707 | file_google_protobuf_struct_proto_rawDescData = file_google_protobuf_struct_proto_rawDesc |
| 708 | ) |
| 709 | |
| 710 | func file_google_protobuf_struct_proto_rawDescGZIP() []byte { |
| 711 | file_google_protobuf_struct_proto_rawDescOnce.Do(func() { |
| 712 | file_google_protobuf_struct_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_struct_proto_rawDescData) |
| 713 | }) |
| 714 | return file_google_protobuf_struct_proto_rawDescData |
| 715 | } |
| 716 | |
| 717 | var file_google_protobuf_struct_proto_enumTypes = make([]protoimpl.EnumInfo, 1) |
| 718 | var file_google_protobuf_struct_proto_msgTypes = make([]protoimpl.MessageInfo, 4) |
| 719 | var file_google_protobuf_struct_proto_goTypes = []interface{}{ |
| 720 | (NullValue)(0), // 0: google.protobuf.NullValue |
| 721 | (*Struct)(nil), // 1: google.protobuf.Struct |
| 722 | (*Value)(nil), // 2: google.protobuf.Value |
| 723 | (*ListValue)(nil), // 3: google.protobuf.ListValue |
| 724 | nil, // 4: google.protobuf.Struct.FieldsEntry |
| 725 | } |
| 726 | var file_google_protobuf_struct_proto_depIdxs = []int32{ |
| 727 | 4, // 0: google.protobuf.Struct.fields:type_name -> google.protobuf.Struct.FieldsEntry |
| 728 | 0, // 1: google.protobuf.Value.null_value:type_name -> google.protobuf.NullValue |
| 729 | 1, // 2: google.protobuf.Value.struct_value:type_name -> google.protobuf.Struct |
| 730 | 3, // 3: google.protobuf.Value.list_value:type_name -> google.protobuf.ListValue |
| 731 | 2, // 4: google.protobuf.ListValue.values:type_name -> google.protobuf.Value |
| 732 | 2, // 5: google.protobuf.Struct.FieldsEntry.value:type_name -> google.protobuf.Value |
| 733 | 6, // [6:6] is the sub-list for method output_type |
| 734 | 6, // [6:6] is the sub-list for method input_type |
| 735 | 6, // [6:6] is the sub-list for extension type_name |
| 736 | 6, // [6:6] is the sub-list for extension extendee |
| 737 | 0, // [0:6] is the sub-list for field type_name |
| 738 | } |
| 739 | |
| 740 | func init() { file_google_protobuf_struct_proto_init() } |
| 741 | func file_google_protobuf_struct_proto_init() { |
| 742 | if File_google_protobuf_struct_proto != nil { |
| 743 | return |
| 744 | } |
| 745 | if !protoimpl.UnsafeEnabled { |
| 746 | file_google_protobuf_struct_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { |
| 747 | switch v := v.(*Struct); i { |
| 748 | case 0: |
| 749 | return &v.state |
| 750 | case 1: |
| 751 | return &v.sizeCache |
| 752 | case 2: |
| 753 | return &v.unknownFields |
| 754 | default: |
| 755 | return nil |
| 756 | } |
| 757 | } |
| 758 | file_google_protobuf_struct_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { |
| 759 | switch v := v.(*Value); i { |
| 760 | case 0: |
| 761 | return &v.state |
| 762 | case 1: |
| 763 | return &v.sizeCache |
| 764 | case 2: |
| 765 | return &v.unknownFields |
| 766 | default: |
| 767 | return nil |
| 768 | } |
| 769 | } |
| 770 | file_google_protobuf_struct_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { |
| 771 | switch v := v.(*ListValue); i { |
| 772 | case 0: |
| 773 | return &v.state |
| 774 | case 1: |
| 775 | return &v.sizeCache |
| 776 | case 2: |
| 777 | return &v.unknownFields |
| 778 | default: |
| 779 | return nil |
| 780 | } |
| 781 | } |
| 782 | } |
| 783 | file_google_protobuf_struct_proto_msgTypes[1].OneofWrappers = []interface{}{ |
| 784 | (*Value_NullValue)(nil), |
| 785 | (*Value_NumberValue)(nil), |
| 786 | (*Value_StringValue)(nil), |
| 787 | (*Value_BoolValue)(nil), |
| 788 | (*Value_StructValue)(nil), |
| 789 | (*Value_ListValue)(nil), |
| 790 | } |
| 791 | type x struct{} |
| 792 | out := protoimpl.TypeBuilder{ |
| 793 | File: protoimpl.DescBuilder{ |
| 794 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), |
| 795 | RawDescriptor: file_google_protobuf_struct_proto_rawDesc, |
| 796 | NumEnums: 1, |
| 797 | NumMessages: 4, |
| 798 | NumExtensions: 0, |
| 799 | NumServices: 0, |
| 800 | }, |
| 801 | GoTypes: file_google_protobuf_struct_proto_goTypes, |
| 802 | DependencyIndexes: file_google_protobuf_struct_proto_depIdxs, |
| 803 | EnumInfos: file_google_protobuf_struct_proto_enumTypes, |
| 804 | MessageInfos: file_google_protobuf_struct_proto_msgTypes, |
| 805 | }.Build() |
| 806 | File_google_protobuf_struct_proto = out.File |
| 807 | file_google_protobuf_struct_proto_rawDesc = nil |
| 808 | file_google_protobuf_struct_proto_goTypes = nil |
| 809 | file_google_protobuf_struct_proto_depIdxs = nil |
| 810 | } |