You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
821 lines
27 KiB
821 lines
27 KiB
2 years ago
|
// Protocol Buffers - Google's data interchange format
|
||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||
|
// https://developers.google.com/protocol-buffers/
|
||
|
//
|
||
|
// 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.
|
||
|
// * Neither the name of Google Inc. nor the names of its
|
||
|
// contributors may be used to endorse or promote products derived from
|
||
|
// this software without specific prior written permission.
|
||
|
//
|
||
|
// 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.
|
||
|
|
||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||
|
// versions:
|
||
|
// protoc-gen-go v1.28.1
|
||
|
// protoc v3.18.1
|
||
|
// source: google/protobuf/struct.proto
|
||
|
|
||
|
// Package structpb contains generated types for google/protobuf/struct.proto.
|
||
|
//
|
||
|
// The messages (i.e., Value, Struct, and ListValue) defined in struct.proto are
|
||
|
// used to represent arbitrary JSON. The Value message represents a JSON value,
|
||
|
// the Struct message represents a JSON object, and the ListValue message
|
||
|
// represents a JSON array. See https://json.org for more information.
|
||
|
//
|
||
|
// The Value, Struct, and ListValue types have generated MarshalJSON and
|
||
|
// UnmarshalJSON methods such that they serialize JSON equivalent to what the
|
||
|
// messages themselves represent. Use of these types with the
|
||
|
// "google.golang.org/protobuf/encoding/protojson" package
|
||
|
// ensures that they will be serialized as their JSON equivalent.
|
||
|
//
|
||
|
//
|
||
|
// Conversion to and from a Go interface
|
||
|
//
|
||
|
// The standard Go "encoding/json" package has functionality to serialize
|
||
|
// arbitrary types to a large degree. The Value.AsInterface, Struct.AsMap, and
|
||
|
// ListValue.AsSlice methods can convert the protobuf message representation into
|
||
|
// a form represented by interface{}, map[string]interface{}, and []interface{}.
|
||
|
// This form can be used with other packages that operate on such data structures
|
||
|
// and also directly with the standard json package.
|
||
|
//
|
||
|
// In order to convert the interface{}, map[string]interface{}, and []interface{}
|
||
|
// forms back as Value, Struct, and ListValue messages, use the NewStruct,
|
||
|
// NewList, and NewValue constructor functions.
|
||
|
//
|
||
|
//
|
||
|
// Example usage
|
||
|
//
|
||
|
// Consider the following example JSON object:
|
||
|
//
|
||
|
// {
|
||
|
// "firstName": "John",
|
||
|
// "lastName": "Smith",
|
||
|
// "isAlive": true,
|
||
|
// "age": 27,
|
||
|
// "address": {
|
||
|
// "streetAddress": "21 2nd Street",
|
||
|
// "city": "New York",
|
||
|
// "state": "NY",
|
||
|
// "postalCode": "10021-3100"
|
||
|
// },
|
||
|
// "phoneNumbers": [
|
||
|
// {
|
||
|
// "type": "home",
|
||
|
// "number": "212 555-1234"
|
||
|
// },
|
||
|
// {
|
||
|
// "type": "office",
|
||
|
// "number": "646 555-4567"
|
||
|
// }
|
||
|
// ],
|
||
|
// "children": [],
|
||
|
// "spouse": null
|
||
|
// }
|
||
|
//
|
||
|
// To construct a Value message representing the above JSON object:
|
||
|
//
|
||
|
// m, err := structpb.NewValue(map[string]interface{}{
|
||
|
// "firstName": "John",
|
||
|
// "lastName": "Smith",
|
||
|
// "isAlive": true,
|
||
|
// "age": 27,
|
||
|
// "address": map[string]interface{}{
|
||
|
// "streetAddress": "21 2nd Street",
|
||
|
// "city": "New York",
|
||
|
// "state": "NY",
|
||
|
// "postalCode": "10021-3100",
|
||
|
// },
|
||
|
// "phoneNumbers": []interface{}{
|
||
|
// map[string]interface{}{
|
||
|
// "type": "home",
|
||
|
// "number": "212 555-1234",
|
||
|
// },
|
||
|
// map[string]interface{}{
|
||
|
// "type": "office",
|
||
|
// "number": "646 555-4567",
|
||
|
// },
|
||
|
// },
|
||
|
// "children": []interface{}{},
|
||
|
// "spouse": nil,
|
||
|
// })
|
||
|
// if err != nil {
|
||
|
// ... // handle error
|
||
|
// }
|
||
|
// ... // make use of m as a *structpb.Value
|
||
|
//
|
||
|
package structpb
|
||
|
|
||
|
import (
|
||
|
base64 "encoding/base64"
|
||
|
protojson "google.golang.org/protobuf/encoding/protojson"
|
||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||
|
math "math"
|
||
|
reflect "reflect"
|
||
|
sync "sync"
|
||
|
utf8 "unicode/utf8"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
// Verify that this generated code is sufficiently up-to-date.
|
||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||
|
)
|
||
|
|
||
|
// `NullValue` is a singleton enumeration to represent the null value for the
|
||
|
// `Value` type union.
|
||
|
//
|
||
|
// The JSON representation for `NullValue` is JSON `null`.
|
||
|
type NullValue int32
|
||
|
|
||
|
const (
|
||
|
// Null value.
|
||
|
NullValue_NULL_VALUE NullValue = 0
|
||
|
)
|
||
|
|
||
|
// Enum value maps for NullValue.
|
||
|
var (
|
||
|
NullValue_name = map[int32]string{
|
||
|
0: "NULL_VALUE",
|
||
|
}
|
||
|
NullValue_value = map[string]int32{
|
||
|
"NULL_VALUE": 0,
|
||
|
}
|
||
|
)
|
||
|
|
||
|
func (x NullValue) Enum() *NullValue {
|
||
|
p := new(NullValue)
|
||
|
*p = x
|
||
|
return p
|
||
|
}
|
||
|
|
||
|
func (x NullValue) String() string {
|
||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||
|
}
|
||
|
|
||
|
func (NullValue) Descriptor() protoreflect.EnumDescriptor {
|
||
|
return file_google_protobuf_struct_proto_enumTypes[0].Descriptor()
|
||
|
}
|
||
|
|
||
|
func (NullValue) Type() protoreflect.EnumType {
|
||
|
return &file_google_protobuf_struct_proto_enumTypes[0]
|
||
|
}
|
||
|
|
||
|
func (x NullValue) Number() protoreflect.EnumNumber {
|
||
|
return protoreflect.EnumNumber(x)
|
||
|
}
|
||
|
|
||
|
// Deprecated: Use NullValue.Descriptor instead.
|
||
|
func (NullValue) EnumDescriptor() ([]byte, []int) {
|
||
|
return file_google_protobuf_struct_proto_rawDescGZIP(), []int{0}
|
||
|
}
|
||
|
|
||
|
// `Struct` represents a structured data value, consisting of fields
|
||
|
// which map to dynamically typed values. In some languages, `Struct`
|
||
|
// might be supported by a native representation. For example, in
|
||
|
// scripting languages like JS a struct is represented as an
|
||
|
// object. The details of that representation are described together
|
||
|
// with the proto support for the language.
|
||
|
//
|
||
|
// The JSON representation for `Struct` is JSON object.
|
||
|
type Struct struct {
|
||
|
state protoimpl.MessageState
|
||
|
sizeCache protoimpl.SizeCache
|
||
|
unknownFields protoimpl.UnknownFields
|
||
|
|
||
|
// Unordered map of dynamically typed values.
|
||
|
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"`
|
||
|
}
|
||
|
|
||
|
// NewStruct constructs a Struct from a general-purpose Go map.
|
||
|
// The map keys must be valid UTF-8.
|
||
|
// The map values are converted using NewValue.
|
||
|
func NewStruct(v map[string]interface{}) (*Struct, error) {
|
||
|
x := &Struct{Fields: make(map[string]*Value, len(v))}
|
||
|
for k, v := range v {
|
||
|
if !utf8.ValidString(k) {
|
||
|
return nil, protoimpl.X.NewError("invalid UTF-8 in string: %q", k)
|
||
|
}
|
||
|
var err error
|
||
|
x.Fields[k], err = NewValue(v)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
return x, nil
|
||
|
}
|
||
|
|
||
|
// AsMap converts x to a general-purpose Go map.
|
||
|
// The map values are converted by calling Value.AsInterface.
|
||
|
func (x *Struct) AsMap() map[string]interface{} {
|
||
|
vs := make(map[string]interface{})
|
||
|
for k, v := range x.GetFields() {
|
||
|
vs[k] = v.AsInterface()
|
||
|
}
|
||
|
return vs
|
||
|
}
|
||
|
|
||
|
func (x *Struct) MarshalJSON() ([]byte, error) {
|
||
|
return protojson.Marshal(x)
|
||
|
}
|
||
|
|
||
|
func (x *Struct) UnmarshalJSON(b []byte) error {
|
||
|
return protojson.Unmarshal(b, x)
|
||
|
}
|
||
|
|
||
|
func (x *Struct) Reset() {
|
||
|
*x = Struct{}
|
||
|
if protoimpl.UnsafeEnabled {
|
||
|
mi := &file_google_protobuf_struct_proto_msgTypes[0]
|
||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
|
ms.StoreMessageInfo(mi)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (x *Struct) String() string {
|
||
|
return protoimpl.X.MessageStringOf(x)
|
||
|
}
|
||
|
|
||
|
func (*Struct) ProtoMessage() {}
|
||
|
|
||
|
func (x *Struct) ProtoReflect() protoreflect.Message {
|
||
|
mi := &file_google_protobuf_struct_proto_msgTypes[0]
|
||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
|
if ms.LoadMessageInfo() == nil {
|
||
|
ms.StoreMessageInfo(mi)
|
||
|
}
|
||
|
return ms
|
||
|
}
|
||
|
return mi.MessageOf(x)
|
||
|
}
|
||
|
|
||
|
// Deprecated: Use Struct.ProtoReflect.Descriptor instead.
|
||
|
func (*Struct) Descriptor() ([]byte, []int) {
|
||
|
return file_google_protobuf_struct_proto_rawDescGZIP(), []int{0}
|
||
|
}
|
||
|
|
||
|
func (x *Struct) GetFields() map[string]*Value {
|
||
|
if x != nil {
|
||
|
return x.Fields
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// `Value` represents a dynamically typed value which can be either
|
||
|
// null, a number, a string, a boolean, a recursive struct value, or a
|
||
|
// list of values. A producer of value is expected to set one of these
|
||
|
// variants. Absence of any variant indicates an error.
|
||
|
//
|
||
|
// The JSON representation for `Value` is JSON value.
|
||
|
type Value struct {
|
||
|
state protoimpl.MessageState
|
||
|
sizeCache protoimpl.SizeCache
|
||
|
unknownFields protoimpl.UnknownFields
|
||
|
|
||
|
// The kind of value.
|
||
|
//
|
||
|
// Types that are assignable to Kind:
|
||
|
// *Value_NullValue
|
||
|
// *Value_NumberValue
|
||
|
// *Value_StringValue
|
||
|
// *Value_BoolValue
|
||
|
// *Value_StructValue
|
||
|
// *Value_ListValue
|
||
|
Kind isValue_Kind `protobuf_oneof:"kind"`
|
||
|
}
|
||
|
|
||
|
// NewValue constructs a Value from a general-purpose Go interface.
|
||
|
//
|
||
|
// ╔════════════════════════╤════════════════════════════════════════════╗
|
||
|
// ║ Go type │ Conversion ║
|
||
|
// ╠════════════════════════╪════════════════════════════════════════════╣
|
||
|
// ║ nil │ stored as NullValue ║
|
||
|
// ║ bool │ stored as BoolValue ║
|
||
|
// ║ int, int32, int64 │ stored as NumberValue ║
|
||
|
// ║ uint, uint32, uint64 │ stored as NumberValue ║
|
||
|
// ║ float32, float64 │ stored as NumberValue ║
|
||
|
// ║ string │ stored as StringValue; must be valid UTF-8 ║
|
||
|
// ║ []byte │ stored as StringValue; base64-encoded ║
|
||
|
// ║ map[string]interface{} │ stored as StructValue ║
|
||
|
// ║ []interface{} │ stored as ListValue ║
|
||
|
// ╚════════════════════════╧════════════════════════════════════════════╝
|
||
|
//
|
||
|
// When converting an int64 or uint64 to a NumberValue, numeric precision loss
|
||
|
// is possible since they are stored as a float64.
|
||
|
func NewValue(v interface{}) (*Value, error) {
|
||
|
switch v := v.(type) {
|
||
|
case nil:
|
||
|
return NewNullValue(), nil
|
||
|
case bool:
|
||
|
return NewBoolValue(v), nil
|
||
|
case int:
|
||
|
return NewNumberValue(float64(v)), nil
|
||
|
case int32:
|
||
|
return NewNumberValue(float64(v)), nil
|
||
|
case int64:
|
||
|
return NewNumberValue(float64(v)), nil
|
||
|
case uint:
|
||
|
return NewNumberValue(float64(v)), nil
|
||
|
case uint32:
|
||
|
return NewNumberValue(float64(v)), nil
|
||
|
case uint64:
|
||
|
return NewNumberValue(float64(v)), nil
|
||
|
case float32:
|
||
|
return NewNumberValue(float64(v)), nil
|
||
|
case float64:
|
||
|
return NewNumberValue(float64(v)), nil
|
||
|
case string:
|
||
|
if !utf8.ValidString(v) {
|
||
|
return nil, protoimpl.X.NewError("invalid UTF-8 in string: %q", v)
|
||
|
}
|
||
|
return NewStringValue(v), nil
|
||
|
case []byte:
|
||
|
s := base64.StdEncoding.EncodeToString(v)
|
||
|
return NewStringValue(s), nil
|
||
|
case map[string]interface{}:
|
||
|
v2, err := NewStruct(v)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return NewStructValue(v2), nil
|
||
|
case []interface{}:
|
||
|
v2, err := NewList(v)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return NewListValue(v2), nil
|
||
|
default:
|
||
|
return nil, protoimpl.X.NewError("invalid type: %T", v)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// NewNullValue constructs a new null Value.
|
||
|
func NewNullValue() *Value {
|
||
|
return &Value{Kind: &Value_NullValue{NullValue: NullValue_NULL_VALUE}}
|
||
|
}
|
||
|
|
||
|
// NewBoolValue constructs a new boolean Value.
|
||
|
func NewBoolValue(v bool) *Value {
|
||
|
return &Value{Kind: &Value_BoolValue{BoolValue: v}}
|
||
|
}
|
||
|
|
||
|
// NewNumberValue constructs a new number Value.
|
||
|
func NewNumberValue(v float64) *Value {
|
||
|
return &Value{Kind: &Value_NumberValue{NumberValue: v}}
|
||
|
}
|
||
|
|
||
|
// NewStringValue constructs a new string Value.
|
||
|
func NewStringValue(v string) *Value {
|
||
|
return &Value{Kind: &Value_StringValue{StringValue: v}}
|
||
|
}
|
||
|
|
||
|
// NewStructValue constructs a new struct Value.
|
||
|
func NewStructValue(v *Struct) *Value {
|
||
|
return &Value{Kind: &Value_StructValue{StructValue: v}}
|
||
|
}
|
||
|
|
||
|
// NewListValue constructs a new list Value.
|
||
|
func NewListValue(v *ListValue) *Value {
|
||
|
return &Value{Kind: &Value_ListValue{ListValue: v}}
|
||
|
}
|
||
|
|
||
|
// AsInterface converts x to a general-purpose Go interface.
|
||
|
//
|
||
|
// Calling Value.MarshalJSON and "encoding/json".Marshal on this output produce
|
||
|
// semantically equivalent JSON (assuming no errors occur).
|
||
|
//
|
||
|
// Floating-point values (i.e., "NaN", "Infinity", and "-Infinity") are
|
||
|
// converted as strings to remain compatible with MarshalJSON.
|
||
|
func (x *Value) AsInterface() interface{} {
|
||
|
switch v := x.GetKind().(type) {
|
||
|
case *Value_NumberValue:
|
||
|
if v != nil {
|
||
|
switch {
|
||
|
case math.IsNaN(v.NumberValue):
|
||
|
return "NaN"
|
||
|
case math.IsInf(v.NumberValue, +1):
|
||
|
return "Infinity"
|
||
|
case math.IsInf(v.NumberValue, -1):
|
||
|
return "-Infinity"
|
||
|
default:
|
||
|
return v.NumberValue
|
||
|
}
|
||
|
}
|
||
|
case *Value_StringValue:
|
||
|
if v != nil {
|
||
|
return v.StringValue
|
||
|
}
|
||
|
case *Value_BoolValue:
|
||
|
if v != nil {
|
||
|
return v.BoolValue
|
||
|
}
|
||
|
case *Value_StructValue:
|
||
|
if v != nil {
|
||
|
return v.StructValue.AsMap()
|
||
|
}
|
||
|
case *Value_ListValue:
|
||
|
if v != nil {
|
||
|
return v.ListValue.AsSlice()
|
||
|
}
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (x *Value) MarshalJSON() ([]byte, error) {
|
||
|
return protojson.Marshal(x)
|
||
|
}
|
||
|
|
||
|
func (x *Value) UnmarshalJSON(b []byte) error {
|
||
|
return protojson.Unmarshal(b, x)
|
||
|
}
|
||
|
|
||
|
func (x *Value) Reset() {
|
||
|
*x = Value{}
|
||
|
if protoimpl.UnsafeEnabled {
|
||
|
mi := &file_google_protobuf_struct_proto_msgTypes[1]
|
||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
|
ms.StoreMessageInfo(mi)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (x *Value) String() string {
|
||
|
return protoimpl.X.MessageStringOf(x)
|
||
|
}
|
||
|
|
||
|
func (*Value) ProtoMessage() {}
|
||
|
|
||
|
func (x *Value) ProtoReflect() protoreflect.Message {
|
||
|
mi := &file_google_protobuf_struct_proto_msgTypes[1]
|
||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
|
if ms.LoadMessageInfo() == nil {
|
||
|
ms.StoreMessageInfo(mi)
|
||
|
}
|
||
|
return ms
|
||
|
}
|
||
|
return mi.MessageOf(x)
|
||
|
}
|
||
|
|
||
|
// Deprecated: Use Value.ProtoReflect.Descriptor instead.
|
||
|
func (*Value) Descriptor() ([]byte, []int) {
|
||
|
return file_google_protobuf_struct_proto_rawDescGZIP(), []int{1}
|
||
|
}
|
||
|
|
||
|
func (m *Value) GetKind() isValue_Kind {
|
||
|
if m != nil {
|
||
|
return m.Kind
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (x *Value) GetNullValue() NullValue {
|
||
|
if x, ok := x.GetKind().(*Value_NullValue); ok {
|
||
|
return x.NullValue
|
||
|
}
|
||
|
return NullValue_NULL_VALUE
|
||
|
}
|
||
|
|
||
|
func (x *Value) GetNumberValue() float64 {
|
||
|
if x, ok := x.GetKind().(*Value_NumberValue); ok {
|
||
|
return x.NumberValue
|
||
|
}
|
||
|
return 0
|
||
|
}
|
||
|
|
||
|
func (x *Value) GetStringValue() string {
|
||
|
if x, ok := x.GetKind().(*Value_StringValue); ok {
|
||
|
return x.StringValue
|
||
|
}
|
||
|
return ""
|
||
|
}
|
||
|
|
||
|
func (x *Value) GetBoolValue() bool {
|
||
|
if x, ok := x.GetKind().(*Value_BoolValue); ok {
|
||
|
return x.BoolValue
|
||
|
}
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
func (x *Value) GetStructValue() *Struct {
|
||
|
if x, ok := x.GetKind().(*Value_StructValue); ok {
|
||
|
return x.StructValue
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (x *Value) GetListValue() *ListValue {
|
||
|
if x, ok := x.GetKind().(*Value_ListValue); ok {
|
||
|
return x.ListValue
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
type isValue_Kind interface {
|
||
|
isValue_Kind()
|
||
|
}
|
||
|
|
||
|
type Value_NullValue struct {
|
||
|
// Represents a null value.
|
||
|
NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"`
|
||
|
}
|
||
|
|
||
|
type Value_NumberValue struct {
|
||
|
// Represents a double value.
|
||
|
NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"`
|
||
|
}
|
||
|
|
||
|
type Value_StringValue struct {
|
||
|
// Represents a string value.
|
||
|
StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"`
|
||
|
}
|
||
|
|
||
|
type Value_BoolValue struct {
|
||
|
// Represents a boolean value.
|
||
|
BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"`
|
||
|
}
|
||
|
|
||
|
type Value_StructValue struct {
|
||
|
// Represents a structured value.
|
||
|
StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"`
|
||
|
}
|
||
|
|
||
|
type Value_ListValue struct {
|
||
|
// Represents a repeated `Value`.
|
||
|
ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof"`
|
||
|
}
|
||
|
|
||
|
func (*Value_NullValue) isValue_Kind() {}
|
||
|
|
||
|
func (*Value_NumberValue) isValue_Kind() {}
|
||
|
|
||
|
func (*Value_StringValue) isValue_Kind() {}
|
||
|
|
||
|
func (*Value_BoolValue) isValue_Kind() {}
|
||
|
|
||
|
func (*Value_StructValue) isValue_Kind() {}
|
||
|
|
||
|
func (*Value_ListValue) isValue_Kind() {}
|
||
|
|
||
|
// `ListValue` is a wrapper around a repeated field of values.
|
||
|
//
|
||
|
// The JSON representation for `ListValue` is JSON array.
|
||
|
type ListValue struct {
|
||
|
state protoimpl.MessageState
|
||
|
sizeCache protoimpl.SizeCache
|
||
|
unknownFields protoimpl.UnknownFields
|
||
|
|
||
|
// Repeated field of dynamically typed values.
|
||
|
Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
|
||
|
}
|
||
|
|
||
|
// NewList constructs a ListValue from a general-purpose Go slice.
|
||
|
// The slice elements are converted using NewValue.
|
||
|
func NewList(v []interface{}) (*ListValue, error) {
|
||
|
x := &ListValue{Values: make([]*Value, len(v))}
|
||
|
for i, v := range v {
|
||
|
var err error
|
||
|
x.Values[i], err = NewValue(v)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
return x, nil
|
||
|
}
|
||
|
|
||
|
// AsSlice converts x to a general-purpose Go slice.
|
||
|
// The slice elements are converted by calling Value.AsInterface.
|
||
|
func (x *ListValue) AsSlice() []interface{} {
|
||
|
vs := make([]interface{}, len(x.GetValues()))
|
||
|
for i, v := range x.GetValues() {
|
||
|
vs[i] = v.AsInterface()
|
||
|
}
|
||
|
return vs
|
||
|
}
|
||
|
|
||
|
func (x *ListValue) MarshalJSON() ([]byte, error) {
|
||
|
return protojson.Marshal(x)
|
||
|
}
|
||
|
|
||
|
func (x *ListValue) UnmarshalJSON(b []byte) error {
|
||
|
return protojson.Unmarshal(b, x)
|
||
|
}
|
||
|
|
||
|
func (x *ListValue) Reset() {
|
||
|
*x = ListValue{}
|
||
|
if protoimpl.UnsafeEnabled {
|
||
|
mi := &file_google_protobuf_struct_proto_msgTypes[2]
|
||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
|
ms.StoreMessageInfo(mi)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (x *ListValue) String() string {
|
||
|
return protoimpl.X.MessageStringOf(x)
|
||
|
}
|
||
|
|
||
|
func (*ListValue) ProtoMessage() {}
|
||
|
|
||
|
func (x *ListValue) ProtoReflect() protoreflect.Message {
|
||
|
mi := &file_google_protobuf_struct_proto_msgTypes[2]
|
||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
|
if ms.LoadMessageInfo() == nil {
|
||
|
ms.StoreMessageInfo(mi)
|
||
|
}
|
||
|
return ms
|
||
|
}
|
||
|
return mi.MessageOf(x)
|
||
|
}
|
||
|
|
||
|
// Deprecated: Use ListValue.ProtoReflect.Descriptor instead.
|
||
|
func (*ListValue) Descriptor() ([]byte, []int) {
|
||
|
return file_google_protobuf_struct_proto_rawDescGZIP(), []int{2}
|
||
|
}
|
||
|
|
||
|
func (x *ListValue) GetValues() []*Value {
|
||
|
if x != nil {
|
||
|
return x.Values
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var File_google_protobuf_struct_proto protoreflect.FileDescriptor
|
||
|
|
||
|
var file_google_protobuf_struct_proto_rawDesc = []byte{
|
||
|
0x0a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||
|
0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f,
|
||
|
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22,
|
||
|
0x98, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3b, 0x0a, 0x06, 0x66, 0x69,
|
||
|
0x65, 0x6c, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f,
|
||
|
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72,
|
||
|
0x75, 0x63, 0x74, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
|
||
|
0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x1a, 0x51, 0x0a, 0x0b, 0x46, 0x69, 0x65, 0x6c, 0x64,
|
||
|
0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
|
||
|
0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
||
|
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||
|
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52,
|
||
|
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb2, 0x02, 0x0a, 0x05, 0x56,
|
||
|
0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x76, 0x61, 0x6c,
|
||
|
0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
|
||
|
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x56,
|
||
|
0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75,
|
||
|
0x65, 0x12, 0x23, 0x0a, 0x0c, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75,
|
||
|
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x62, 0x65,
|
||
|
0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
|
||
|
0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b,
|
||
|
0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62,
|
||
|
0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48,
|
||
|
0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0c,
|
||
|
0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01,
|
||
|
0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||
|
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x73,
|
||
|
0x74, 0x72, 0x75, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6c, 0x69,
|
||
|
0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,
|
||
|
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||
|
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6c, 0x69,
|
||
|
0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22,
|
||
|
0x3b, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2e, 0x0a, 0x06,
|
||
|
0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67,
|
||
|
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56,
|
||
|
0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2a, 0x1b, 0x0a, 0x09,
|
||
|
0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x55, 0x4c,
|
||
|
0x4c, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x00, 0x42, 0x7f, 0x0a, 0x13, 0x63, 0x6f, 0x6d,
|
||
|
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||
|
0x42, 0x0b, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a,
|
||
|
0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f,
|
||
|
0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65,
|
||
|
0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x70, 0x62,
|
||
|
0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67,
|
||
|
0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c,
|
||
|
0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||
|
0x6f, 0x33,
|
||
|
}
|
||
|
|
||
|
var (
|
||
|
file_google_protobuf_struct_proto_rawDescOnce sync.Once
|
||
|
file_google_protobuf_struct_proto_rawDescData = file_google_protobuf_struct_proto_rawDesc
|
||
|
)
|
||
|
|
||
|
func file_google_protobuf_struct_proto_rawDescGZIP() []byte {
|
||
|
file_google_protobuf_struct_proto_rawDescOnce.Do(func() {
|
||
|
file_google_protobuf_struct_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_struct_proto_rawDescData)
|
||
|
})
|
||
|
return file_google_protobuf_struct_proto_rawDescData
|
||
|
}
|
||
|
|
||
|
var file_google_protobuf_struct_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||
|
var file_google_protobuf_struct_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||
|
var file_google_protobuf_struct_proto_goTypes = []interface{}{
|
||
|
(NullValue)(0), // 0: google.protobuf.NullValue
|
||
|
(*Struct)(nil), // 1: google.protobuf.Struct
|
||
|
(*Value)(nil), // 2: google.protobuf.Value
|
||
|
(*ListValue)(nil), // 3: google.protobuf.ListValue
|
||
|
nil, // 4: google.protobuf.Struct.FieldsEntry
|
||
|
}
|
||
|
var file_google_protobuf_struct_proto_depIdxs = []int32{
|
||
|
4, // 0: google.protobuf.Struct.fields:type_name -> google.protobuf.Struct.FieldsEntry
|
||
|
0, // 1: google.protobuf.Value.null_value:type_name -> google.protobuf.NullValue
|
||
|
1, // 2: google.protobuf.Value.struct_value:type_name -> google.protobuf.Struct
|
||
|
3, // 3: google.protobuf.Value.list_value:type_name -> google.protobuf.ListValue
|
||
|
2, // 4: google.protobuf.ListValue.values:type_name -> google.protobuf.Value
|
||
|
2, // 5: google.protobuf.Struct.FieldsEntry.value:type_name -> google.protobuf.Value
|
||
|
6, // [6:6] is the sub-list for method output_type
|
||
|
6, // [6:6] is the sub-list for method input_type
|
||
|
6, // [6:6] is the sub-list for extension type_name
|
||
|
6, // [6:6] is the sub-list for extension extendee
|
||
|
0, // [0:6] is the sub-list for field type_name
|
||
|
}
|
||
|
|
||
|
func init() { file_google_protobuf_struct_proto_init() }
|
||
|
func file_google_protobuf_struct_proto_init() {
|
||
|
if File_google_protobuf_struct_proto != nil {
|
||
|
return
|
||
|
}
|
||
|
if !protoimpl.UnsafeEnabled {
|
||
|
file_google_protobuf_struct_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||
|
switch v := v.(*Struct); i {
|
||
|
case 0:
|
||
|
return &v.state
|
||
|
case 1:
|
||
|
return &v.sizeCache
|
||
|
case 2:
|
||
|
return &v.unknownFields
|
||
|
default:
|
||
|
return nil
|
||
|
}
|
||
|
}
|
||
|
file_google_protobuf_struct_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||
|
switch v := v.(*Value); i {
|
||
|
case 0:
|
||
|
return &v.state
|
||
|
case 1:
|
||
|
return &v.sizeCache
|
||
|
case 2:
|
||
|
return &v.unknownFields
|
||
|
default:
|
||
|
return nil
|
||
|
}
|
||
|
}
|
||
|
file_google_protobuf_struct_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||
|
switch v := v.(*ListValue); i {
|
||
|
case 0:
|
||
|
return &v.state
|
||
|
case 1:
|
||
|
return &v.sizeCache
|
||
|
case 2:
|
||
|
return &v.unknownFields
|
||
|
default:
|
||
|
return nil
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
file_google_protobuf_struct_proto_msgTypes[1].OneofWrappers = []interface{}{
|
||
|
(*Value_NullValue)(nil),
|
||
|
(*Value_NumberValue)(nil),
|
||
|
(*Value_StringValue)(nil),
|
||
|
(*Value_BoolValue)(nil),
|
||
|
(*Value_StructValue)(nil),
|
||
|
(*Value_ListValue)(nil),
|
||
|
}
|
||
|
type x struct{}
|
||
|
out := protoimpl.TypeBuilder{
|
||
|
File: protoimpl.DescBuilder{
|
||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||
|
RawDescriptor: file_google_protobuf_struct_proto_rawDesc,
|
||
|
NumEnums: 1,
|
||
|
NumMessages: 4,
|
||
|
NumExtensions: 0,
|
||
|
NumServices: 0,
|
||
|
},
|
||
|
GoTypes: file_google_protobuf_struct_proto_goTypes,
|
||
|
DependencyIndexes: file_google_protobuf_struct_proto_depIdxs,
|
||
|
EnumInfos: file_google_protobuf_struct_proto_enumTypes,
|
||
|
MessageInfos: file_google_protobuf_struct_proto_msgTypes,
|
||
|
}.Build()
|
||
|
File_google_protobuf_struct_proto = out.File
|
||
|
file_google_protobuf_struct_proto_rawDesc = nil
|
||
|
file_google_protobuf_struct_proto_goTypes = nil
|
||
|
file_google_protobuf_struct_proto_depIdxs = nil
|
||
|
}
|