Pin new dependency: github.com/google/cel-go v0.9.0

This commit is contained in:
Joe Betz
2021-11-01 14:08:09 -04:00
parent 91ff1f9840
commit d73403dc12
304 changed files with 48716 additions and 995 deletions

View File

@@ -744,9 +744,6 @@ func (d decoder) skipValue() error {
// Skip items. This will not validate whether skipped values are
// of the same type or not, same behavior as C++
// TextFormat::Parser::AllowUnknownField(true) version 3.8.0.
if err := d.skipValue(); err != nil {
return err
}
}
}
}

View File

@@ -263,3 +263,8 @@ func (e *Encoder) Snapshot() encoderState {
func (e *Encoder) Reset(es encoderState) {
e.encoderState = es
}
// AppendString appends the escaped form of the input string to b.
func AppendString(b []byte, s string) []byte {
return appendString(b, s, false)
}

View File

@@ -440,6 +440,13 @@ func legacyMerge(in piface.MergeInput) piface.MergeOutput {
if !ok {
return piface.MergeOutput{}
}
if !in.Source.IsValid() {
// Legacy Marshal methods may not function on nil messages.
// Check for a typed nil source only after we confirm that
// legacy Marshal/Unmarshal methods are present, for
// consistency.
return piface.MergeOutput{Flags: piface.MergeComplete}
}
b, err := marshaler.Marshal()
if err != nil {
return piface.MergeOutput{}

View File

@@ -52,8 +52,8 @@ import (
// 10. Send out the CL for review and submit it.
const (
Major = 1
Minor = 26
Patch = 0
Minor = 27
Patch = 1
PreRelease = ""
)

View File

@@ -94,7 +94,8 @@ type Files struct {
// Note that enum values are in the top-level since that are in the same
// scope as the parent enum.
descsByName map[protoreflect.FullName]interface{}
filesByPath map[string]protoreflect.FileDescriptor
filesByPath map[string][]protoreflect.FileDescriptor
numFiles int
}
type packageDescriptor struct {
@@ -117,17 +118,16 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error {
r.descsByName = map[protoreflect.FullName]interface{}{
"": &packageDescriptor{},
}
r.filesByPath = make(map[string]protoreflect.FileDescriptor)
r.filesByPath = make(map[string][]protoreflect.FileDescriptor)
}
path := file.Path()
if prev := r.filesByPath[path]; prev != nil {
if prev := r.filesByPath[path]; len(prev) > 0 {
r.checkGenProtoConflict(path)
err := errors.New("file %q is already registered", file.Path())
err = amendErrorWithCaller(err, prev, file)
if r == GlobalFiles && ignoreConflict(file, err) {
err = nil
err = amendErrorWithCaller(err, prev[0], file)
if !(r == GlobalFiles && ignoreConflict(file, err)) {
return err
}
return err
}
for name := file.Package(); name != ""; name = name.Parent() {
@@ -168,7 +168,8 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error {
rangeTopLevelDescriptors(file, func(d protoreflect.Descriptor) {
r.descsByName[d.FullName()] = d
})
r.filesByPath[path] = file
r.filesByPath[path] = append(r.filesByPath[path], file)
r.numFiles++
return nil
}
@@ -308,6 +309,7 @@ func (s *nameSuffix) Pop() (name protoreflect.Name) {
// FindFileByPath looks up a file by the path.
//
// This returns (nil, NotFound) if not found.
// This returns an error if multiple files have the same path.
func (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error) {
if r == nil {
return nil, NotFound
@@ -316,13 +318,19 @@ func (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error)
globalMutex.RLock()
defer globalMutex.RUnlock()
}
if fd, ok := r.filesByPath[path]; ok {
return fd, nil
fds := r.filesByPath[path]
switch len(fds) {
case 0:
return nil, NotFound
case 1:
return fds[0], nil
default:
return nil, errors.New("multiple files named %q", path)
}
return nil, NotFound
}
// NumFiles reports the number of registered files.
// NumFiles reports the number of registered files,
// including duplicate files with the same name.
func (r *Files) NumFiles() int {
if r == nil {
return 0
@@ -331,10 +339,11 @@ func (r *Files) NumFiles() int {
globalMutex.RLock()
defer globalMutex.RUnlock()
}
return len(r.filesByPath)
return r.numFiles
}
// RangeFiles iterates over all registered files while f returns true.
// If multiple files have the same name, RangeFiles iterates over all of them.
// The iteration order is undefined.
func (r *Files) RangeFiles(f func(protoreflect.FileDescriptor) bool) {
if r == nil {
@@ -344,9 +353,11 @@ func (r *Files) RangeFiles(f func(protoreflect.FileDescriptor) bool) {
globalMutex.RLock()
defer globalMutex.RUnlock()
}
for _, file := range r.filesByPath {
if !f(file) {
return
for _, files := range r.filesByPath {
for _, file := range files {
if !f(file) {
return
}
}
}
}

View File

@@ -43,7 +43,6 @@ package descriptorpb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
@@ -829,15 +828,6 @@ func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) {
return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{3}
}
var extRange_ExtensionRangeOptions = []protoiface.ExtensionRangeV1{
{Start: 1000, End: 536870911},
}
// Deprecated: Use ExtensionRangeOptions.ProtoReflect.Descriptor.ExtensionRanges instead.
func (*ExtensionRangeOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
return extRange_ExtensionRangeOptions
}
func (x *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption {
if x != nil {
return x.UninterpretedOption
@@ -1520,15 +1510,6 @@ func (*FileOptions) Descriptor() ([]byte, []int) {
return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{10}
}
var extRange_FileOptions = []protoiface.ExtensionRangeV1{
{Start: 1000, End: 536870911},
}
// Deprecated: Use FileOptions.ProtoReflect.Descriptor.ExtensionRanges instead.
func (*FileOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
return extRange_FileOptions
}
func (x *FileOptions) GetJavaPackage() string {
if x != nil && x.JavaPackage != nil {
return *x.JavaPackage
@@ -1776,15 +1757,6 @@ func (*MessageOptions) Descriptor() ([]byte, []int) {
return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{11}
}
var extRange_MessageOptions = []protoiface.ExtensionRangeV1{
{Start: 1000, End: 536870911},
}
// Deprecated: Use MessageOptions.ProtoReflect.Descriptor.ExtensionRanges instead.
func (*MessageOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
return extRange_MessageOptions
}
func (x *MessageOptions) GetMessageSetWireFormat() bool {
if x != nil && x.MessageSetWireFormat != nil {
return *x.MessageSetWireFormat
@@ -1930,15 +1902,6 @@ func (*FieldOptions) Descriptor() ([]byte, []int) {
return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12}
}
var extRange_FieldOptions = []protoiface.ExtensionRangeV1{
{Start: 1000, End: 536870911},
}
// Deprecated: Use FieldOptions.ProtoReflect.Descriptor.ExtensionRanges instead.
func (*FieldOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
return extRange_FieldOptions
}
func (x *FieldOptions) GetCtype() FieldOptions_CType {
if x != nil && x.Ctype != nil {
return *x.Ctype
@@ -2030,15 +1993,6 @@ func (*OneofOptions) Descriptor() ([]byte, []int) {
return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{13}
}
var extRange_OneofOptions = []protoiface.ExtensionRangeV1{
{Start: 1000, End: 536870911},
}
// Deprecated: Use OneofOptions.ProtoReflect.Descriptor.ExtensionRanges instead.
func (*OneofOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
return extRange_OneofOptions
}
func (x *OneofOptions) GetUninterpretedOption() []*UninterpretedOption {
if x != nil {
return x.UninterpretedOption
@@ -2101,15 +2055,6 @@ func (*EnumOptions) Descriptor() ([]byte, []int) {
return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{14}
}
var extRange_EnumOptions = []protoiface.ExtensionRangeV1{
{Start: 1000, End: 536870911},
}
// Deprecated: Use EnumOptions.ProtoReflect.Descriptor.ExtensionRanges instead.
func (*EnumOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
return extRange_EnumOptions
}
func (x *EnumOptions) GetAllowAlias() bool {
if x != nil && x.AllowAlias != nil {
return *x.AllowAlias
@@ -2183,15 +2128,6 @@ func (*EnumValueOptions) Descriptor() ([]byte, []int) {
return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{15}
}
var extRange_EnumValueOptions = []protoiface.ExtensionRangeV1{
{Start: 1000, End: 536870911},
}
// Deprecated: Use EnumValueOptions.ProtoReflect.Descriptor.ExtensionRanges instead.
func (*EnumValueOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
return extRange_EnumValueOptions
}
func (x *EnumValueOptions) GetDeprecated() bool {
if x != nil && x.Deprecated != nil {
return *x.Deprecated
@@ -2258,15 +2194,6 @@ func (*ServiceOptions) Descriptor() ([]byte, []int) {
return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{16}
}
var extRange_ServiceOptions = []protoiface.ExtensionRangeV1{
{Start: 1000, End: 536870911},
}
// Deprecated: Use ServiceOptions.ProtoReflect.Descriptor.ExtensionRanges instead.
func (*ServiceOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
return extRange_ServiceOptions
}
func (x *ServiceOptions) GetDeprecated() bool {
if x != nil && x.Deprecated != nil {
return *x.Deprecated
@@ -2335,15 +2262,6 @@ func (*MethodOptions) Descriptor() ([]byte, []int) {
return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{17}
}
var extRange_MethodOptions = []protoiface.ExtensionRangeV1{
{Start: 1000, End: 536870911},
}
// Deprecated: Use MethodOptions.ProtoReflect.Descriptor.ExtensionRanges instead.
func (*MethodOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
return extRange_MethodOptions
}
func (x *MethodOptions) GetDeprecated() bool {
if x != nil && x.Deprecated != nil {
return *x.Deprecated

View File

@@ -0,0 +1,713 @@
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package dynamicpb creates protocol buffer messages using runtime type information.
package dynamicpb
import (
"math"
"google.golang.org/protobuf/internal/errors"
pref "google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/runtime/protoiface"
"google.golang.org/protobuf/runtime/protoimpl"
)
// enum is a dynamic protoreflect.Enum.
type enum struct {
num pref.EnumNumber
typ pref.EnumType
}
func (e enum) Descriptor() pref.EnumDescriptor { return e.typ.Descriptor() }
func (e enum) Type() pref.EnumType { return e.typ }
func (e enum) Number() pref.EnumNumber { return e.num }
// enumType is a dynamic protoreflect.EnumType.
type enumType struct {
desc pref.EnumDescriptor
}
// NewEnumType creates a new EnumType with the provided descriptor.
//
// EnumTypes created by this package are equal if their descriptors are equal.
// That is, if ed1 == ed2, then NewEnumType(ed1) == NewEnumType(ed2).
//
// Enum values created by the EnumType are equal if their numbers are equal.
func NewEnumType(desc pref.EnumDescriptor) pref.EnumType {
return enumType{desc}
}
func (et enumType) New(n pref.EnumNumber) pref.Enum { return enum{n, et} }
func (et enumType) Descriptor() pref.EnumDescriptor { return et.desc }
// extensionType is a dynamic protoreflect.ExtensionType.
type extensionType struct {
desc extensionTypeDescriptor
}
// A Message is a dynamically constructed protocol buffer message.
//
// Message implements the proto.Message interface, and may be used with all
// standard proto package functions such as Marshal, Unmarshal, and so forth.
//
// Message also implements the protoreflect.Message interface. See the protoreflect
// package documentation for that interface for how to get and set fields and
// otherwise interact with the contents of a Message.
//
// Reflection API functions which construct messages, such as NewField,
// return new dynamic messages of the appropriate type. Functions which take
// messages, such as Set for a message-value field, will accept any message
// with a compatible type.
//
// Operations which modify a Message are not safe for concurrent use.
type Message struct {
typ messageType
known map[pref.FieldNumber]pref.Value
ext map[pref.FieldNumber]pref.FieldDescriptor
unknown pref.RawFields
}
var (
_ pref.Message = (*Message)(nil)
_ pref.ProtoMessage = (*Message)(nil)
_ protoiface.MessageV1 = (*Message)(nil)
)
// NewMessage creates a new message with the provided descriptor.
func NewMessage(desc pref.MessageDescriptor) *Message {
return &Message{
typ: messageType{desc},
known: make(map[pref.FieldNumber]pref.Value),
ext: make(map[pref.FieldNumber]pref.FieldDescriptor),
}
}
// ProtoMessage implements the legacy message interface.
func (m *Message) ProtoMessage() {}
// ProtoReflect implements the protoreflect.ProtoMessage interface.
func (m *Message) ProtoReflect() pref.Message {
return m
}
// String returns a string representation of a message.
func (m *Message) String() string {
return protoimpl.X.MessageStringOf(m)
}
// Reset clears the message to be empty, but preserves the dynamic message type.
func (m *Message) Reset() {
m.known = make(map[pref.FieldNumber]pref.Value)
m.ext = make(map[pref.FieldNumber]pref.FieldDescriptor)
m.unknown = nil
}
// Descriptor returns the message descriptor.
func (m *Message) Descriptor() pref.MessageDescriptor {
return m.typ.desc
}
// Type returns the message type.
func (m *Message) Type() pref.MessageType {
return m.typ
}
// New returns a newly allocated empty message with the same descriptor.
// See protoreflect.Message for details.
func (m *Message) New() pref.Message {
return m.Type().New()
}
// Interface returns the message.
// See protoreflect.Message for details.
func (m *Message) Interface() pref.ProtoMessage {
return m
}
// ProtoMethods is an internal detail of the protoreflect.Message interface.
// Users should never call this directly.
func (m *Message) ProtoMethods() *protoiface.Methods {
return nil
}
// Range visits every populated field in undefined order.
// See protoreflect.Message for details.
func (m *Message) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
for num, v := range m.known {
fd := m.ext[num]
if fd == nil {
fd = m.Descriptor().Fields().ByNumber(num)
}
if !isSet(fd, v) {
continue
}
if !f(fd, v) {
return
}
}
}
// Has reports whether a field is populated.
// See protoreflect.Message for details.
func (m *Message) Has(fd pref.FieldDescriptor) bool {
m.checkField(fd)
if fd.IsExtension() && m.ext[fd.Number()] != fd {
return false
}
v, ok := m.known[fd.Number()]
if !ok {
return false
}
return isSet(fd, v)
}
// Clear clears a field.
// See protoreflect.Message for details.
func (m *Message) Clear(fd pref.FieldDescriptor) {
m.checkField(fd)
num := fd.Number()
delete(m.known, num)
delete(m.ext, num)
}
// Get returns the value of a field.
// See protoreflect.Message for details.
func (m *Message) Get(fd pref.FieldDescriptor) pref.Value {
m.checkField(fd)
num := fd.Number()
if fd.IsExtension() {
if fd != m.ext[num] {
return fd.(pref.ExtensionTypeDescriptor).Type().Zero()
}
return m.known[num]
}
if v, ok := m.known[num]; ok {
switch {
case fd.IsMap():
if v.Map().Len() > 0 {
return v
}
case fd.IsList():
if v.List().Len() > 0 {
return v
}
default:
return v
}
}
switch {
case fd.IsMap():
return pref.ValueOfMap(&dynamicMap{desc: fd})
case fd.IsList():
return pref.ValueOfList(emptyList{desc: fd})
case fd.Message() != nil:
return pref.ValueOfMessage(&Message{typ: messageType{fd.Message()}})
case fd.Kind() == pref.BytesKind:
return pref.ValueOfBytes(append([]byte(nil), fd.Default().Bytes()...))
default:
return fd.Default()
}
}
// Mutable returns a mutable reference to a repeated, map, or message field.
// See protoreflect.Message for details.
func (m *Message) Mutable(fd pref.FieldDescriptor) pref.Value {
m.checkField(fd)
if !fd.IsMap() && !fd.IsList() && fd.Message() == nil {
panic(errors.New("%v: getting mutable reference to non-composite type", fd.FullName()))
}
if m.known == nil {
panic(errors.New("%v: modification of read-only message", fd.FullName()))
}
num := fd.Number()
if fd.IsExtension() {
if fd != m.ext[num] {
m.ext[num] = fd
m.known[num] = fd.(pref.ExtensionTypeDescriptor).Type().New()
}
return m.known[num]
}
if v, ok := m.known[num]; ok {
return v
}
m.clearOtherOneofFields(fd)
m.known[num] = m.NewField(fd)
if fd.IsExtension() {
m.ext[num] = fd
}
return m.known[num]
}
// Set stores a value in a field.
// See protoreflect.Message for details.
func (m *Message) Set(fd pref.FieldDescriptor, v pref.Value) {
m.checkField(fd)
if m.known == nil {
panic(errors.New("%v: modification of read-only message", fd.FullName()))
}
if fd.IsExtension() {
isValid := true
switch {
case !fd.(pref.ExtensionTypeDescriptor).Type().IsValidValue(v):
isValid = false
case fd.IsList():
isValid = v.List().IsValid()
case fd.IsMap():
isValid = v.Map().IsValid()
case fd.Message() != nil:
isValid = v.Message().IsValid()
}
if !isValid {
panic(errors.New("%v: assigning invalid type %T", fd.FullName(), v.Interface()))
}
m.ext[fd.Number()] = fd
} else {
typecheck(fd, v)
}
m.clearOtherOneofFields(fd)
m.known[fd.Number()] = v
}
func (m *Message) clearOtherOneofFields(fd pref.FieldDescriptor) {
od := fd.ContainingOneof()
if od == nil {
return
}
num := fd.Number()
for i := 0; i < od.Fields().Len(); i++ {
if n := od.Fields().Get(i).Number(); n != num {
delete(m.known, n)
}
}
}
// NewField returns a new value for assignable to the field of a given descriptor.
// See protoreflect.Message for details.
func (m *Message) NewField(fd pref.FieldDescriptor) pref.Value {
m.checkField(fd)
switch {
case fd.IsExtension():
return fd.(pref.ExtensionTypeDescriptor).Type().New()
case fd.IsMap():
return pref.ValueOfMap(&dynamicMap{
desc: fd,
mapv: make(map[interface{}]pref.Value),
})
case fd.IsList():
return pref.ValueOfList(&dynamicList{desc: fd})
case fd.Message() != nil:
return pref.ValueOfMessage(NewMessage(fd.Message()).ProtoReflect())
default:
return fd.Default()
}
}
// WhichOneof reports which field in a oneof is populated, returning nil if none are populated.
// See protoreflect.Message for details.
func (m *Message) WhichOneof(od pref.OneofDescriptor) pref.FieldDescriptor {
for i := 0; i < od.Fields().Len(); i++ {
fd := od.Fields().Get(i)
if m.Has(fd) {
return fd
}
}
return nil
}
// GetUnknown returns the raw unknown fields.
// See protoreflect.Message for details.
func (m *Message) GetUnknown() pref.RawFields {
return m.unknown
}
// SetUnknown sets the raw unknown fields.
// See protoreflect.Message for details.
func (m *Message) SetUnknown(r pref.RawFields) {
if m.known == nil {
panic(errors.New("%v: modification of read-only message", m.typ.desc.FullName()))
}
m.unknown = r
}
// IsValid reports whether the message is valid.
// See protoreflect.Message for details.
func (m *Message) IsValid() bool {
return m.known != nil
}
func (m *Message) checkField(fd pref.FieldDescriptor) {
if fd.IsExtension() && fd.ContainingMessage().FullName() == m.Descriptor().FullName() {
if _, ok := fd.(pref.ExtensionTypeDescriptor); !ok {
panic(errors.New("%v: extension field descriptor does not implement ExtensionTypeDescriptor", fd.FullName()))
}
return
}
if fd.Parent() == m.Descriptor() {
return
}
fields := m.Descriptor().Fields()
index := fd.Index()
if index >= fields.Len() || fields.Get(index) != fd {
panic(errors.New("%v: field descriptor does not belong to this message", fd.FullName()))
}
}
type messageType struct {
desc pref.MessageDescriptor
}
// NewMessageType creates a new MessageType with the provided descriptor.
//
// MessageTypes created by this package are equal if their descriptors are equal.
// That is, if md1 == md2, then NewMessageType(md1) == NewMessageType(md2).
func NewMessageType(desc pref.MessageDescriptor) pref.MessageType {
return messageType{desc}
}
func (mt messageType) New() pref.Message { return NewMessage(mt.desc) }
func (mt messageType) Zero() pref.Message { return &Message{typ: messageType{mt.desc}} }
func (mt messageType) Descriptor() pref.MessageDescriptor { return mt.desc }
func (mt messageType) Enum(i int) pref.EnumType {
if ed := mt.desc.Fields().Get(i).Enum(); ed != nil {
return NewEnumType(ed)
}
return nil
}
func (mt messageType) Message(i int) pref.MessageType {
if md := mt.desc.Fields().Get(i).Message(); md != nil {
return NewMessageType(md)
}
return nil
}
type emptyList struct {
desc pref.FieldDescriptor
}
func (x emptyList) Len() int { return 0 }
func (x emptyList) Get(n int) pref.Value { panic(errors.New("out of range")) }
func (x emptyList) Set(n int, v pref.Value) { panic(errors.New("modification of immutable list")) }
func (x emptyList) Append(v pref.Value) { panic(errors.New("modification of immutable list")) }
func (x emptyList) AppendMutable() pref.Value { panic(errors.New("modification of immutable list")) }
func (x emptyList) Truncate(n int) { panic(errors.New("modification of immutable list")) }
func (x emptyList) NewElement() pref.Value { return newListEntry(x.desc) }
func (x emptyList) IsValid() bool { return false }
type dynamicList struct {
desc pref.FieldDescriptor
list []pref.Value
}
func (x *dynamicList) Len() int {
return len(x.list)
}
func (x *dynamicList) Get(n int) pref.Value {
return x.list[n]
}
func (x *dynamicList) Set(n int, v pref.Value) {
typecheckSingular(x.desc, v)
x.list[n] = v
}
func (x *dynamicList) Append(v pref.Value) {
typecheckSingular(x.desc, v)
x.list = append(x.list, v)
}
func (x *dynamicList) AppendMutable() pref.Value {
if x.desc.Message() == nil {
panic(errors.New("%v: invalid AppendMutable on list with non-message type", x.desc.FullName()))
}
v := x.NewElement()
x.Append(v)
return v
}
func (x *dynamicList) Truncate(n int) {
// Zero truncated elements to avoid keeping data live.
for i := n; i < len(x.list); i++ {
x.list[i] = pref.Value{}
}
x.list = x.list[:n]
}
func (x *dynamicList) NewElement() pref.Value {
return newListEntry(x.desc)
}
func (x *dynamicList) IsValid() bool {
return true
}
type dynamicMap struct {
desc pref.FieldDescriptor
mapv map[interface{}]pref.Value
}
func (x *dynamicMap) Get(k pref.MapKey) pref.Value { return x.mapv[k.Interface()] }
func (x *dynamicMap) Set(k pref.MapKey, v pref.Value) {
typecheckSingular(x.desc.MapKey(), k.Value())
typecheckSingular(x.desc.MapValue(), v)
x.mapv[k.Interface()] = v
}
func (x *dynamicMap) Has(k pref.MapKey) bool { return x.Get(k).IsValid() }
func (x *dynamicMap) Clear(k pref.MapKey) { delete(x.mapv, k.Interface()) }
func (x *dynamicMap) Mutable(k pref.MapKey) pref.Value {
if x.desc.MapValue().Message() == nil {
panic(errors.New("%v: invalid Mutable on map with non-message value type", x.desc.FullName()))
}
v := x.Get(k)
if !v.IsValid() {
v = x.NewValue()
x.Set(k, v)
}
return v
}
func (x *dynamicMap) Len() int { return len(x.mapv) }
func (x *dynamicMap) NewValue() pref.Value {
if md := x.desc.MapValue().Message(); md != nil {
return pref.ValueOfMessage(NewMessage(md).ProtoReflect())
}
return x.desc.MapValue().Default()
}
func (x *dynamicMap) IsValid() bool {
return x.mapv != nil
}
func (x *dynamicMap) Range(f func(pref.MapKey, pref.Value) bool) {
for k, v := range x.mapv {
if !f(pref.ValueOf(k).MapKey(), v) {
return
}
}
}
func isSet(fd pref.FieldDescriptor, v pref.Value) bool {
switch {
case fd.IsMap():
return v.Map().Len() > 0
case fd.IsList():
return v.List().Len() > 0
case fd.ContainingOneof() != nil:
return true
case fd.Syntax() == pref.Proto3 && !fd.IsExtension():
switch fd.Kind() {
case pref.BoolKind:
return v.Bool()
case pref.EnumKind:
return v.Enum() != 0
case pref.Int32Kind, pref.Sint32Kind, pref.Int64Kind, pref.Sint64Kind, pref.Sfixed32Kind, pref.Sfixed64Kind:
return v.Int() != 0
case pref.Uint32Kind, pref.Uint64Kind, pref.Fixed32Kind, pref.Fixed64Kind:
return v.Uint() != 0
case pref.FloatKind, pref.DoubleKind:
return v.Float() != 0 || math.Signbit(v.Float())
case pref.StringKind:
return v.String() != ""
case pref.BytesKind:
return len(v.Bytes()) > 0
}
}
return true
}
func typecheck(fd pref.FieldDescriptor, v pref.Value) {
if err := typeIsValid(fd, v); err != nil {
panic(err)
}
}
func typeIsValid(fd pref.FieldDescriptor, v pref.Value) error {
switch {
case !v.IsValid():
return errors.New("%v: assigning invalid value", fd.FullName())
case fd.IsMap():
if mapv, ok := v.Interface().(*dynamicMap); !ok || mapv.desc != fd || !mapv.IsValid() {
return errors.New("%v: assigning invalid type %T", fd.FullName(), v.Interface())
}
return nil
case fd.IsList():
switch list := v.Interface().(type) {
case *dynamicList:
if list.desc == fd && list.IsValid() {
return nil
}
case emptyList:
if list.desc == fd && list.IsValid() {
return nil
}
}
return errors.New("%v: assigning invalid type %T", fd.FullName(), v.Interface())
default:
return singularTypeIsValid(fd, v)
}
}
func typecheckSingular(fd pref.FieldDescriptor, v pref.Value) {
if err := singularTypeIsValid(fd, v); err != nil {
panic(err)
}
}
func singularTypeIsValid(fd pref.FieldDescriptor, v pref.Value) error {
vi := v.Interface()
var ok bool
switch fd.Kind() {
case pref.BoolKind:
_, ok = vi.(bool)
case pref.EnumKind:
// We could check against the valid set of enum values, but do not.
_, ok = vi.(pref.EnumNumber)
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
_, ok = vi.(int32)
case pref.Uint32Kind, pref.Fixed32Kind:
_, ok = vi.(uint32)
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
_, ok = vi.(int64)
case pref.Uint64Kind, pref.Fixed64Kind:
_, ok = vi.(uint64)
case pref.FloatKind:
_, ok = vi.(float32)
case pref.DoubleKind:
_, ok = vi.(float64)
case pref.StringKind:
_, ok = vi.(string)
case pref.BytesKind:
_, ok = vi.([]byte)
case pref.MessageKind, pref.GroupKind:
var m pref.Message
m, ok = vi.(pref.Message)
if ok && m.Descriptor().FullName() != fd.Message().FullName() {
return errors.New("%v: assigning invalid message type %v", fd.FullName(), m.Descriptor().FullName())
}
if dm, ok := vi.(*Message); ok && dm.known == nil {
return errors.New("%v: assigning invalid zero-value message", fd.FullName())
}
}
if !ok {
return errors.New("%v: assigning invalid type %T", fd.FullName(), v.Interface())
}
return nil
}
func newListEntry(fd pref.FieldDescriptor) pref.Value {
switch fd.Kind() {
case pref.BoolKind:
return pref.ValueOfBool(false)
case pref.EnumKind:
return pref.ValueOfEnum(fd.Enum().Values().Get(0).Number())
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
return pref.ValueOfInt32(0)
case pref.Uint32Kind, pref.Fixed32Kind:
return pref.ValueOfUint32(0)
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
return pref.ValueOfInt64(0)
case pref.Uint64Kind, pref.Fixed64Kind:
return pref.ValueOfUint64(0)
case pref.FloatKind:
return pref.ValueOfFloat32(0)
case pref.DoubleKind:
return pref.ValueOfFloat64(0)
case pref.StringKind:
return pref.ValueOfString("")
case pref.BytesKind:
return pref.ValueOfBytes(nil)
case pref.MessageKind, pref.GroupKind:
return pref.ValueOfMessage(NewMessage(fd.Message()).ProtoReflect())
}
panic(errors.New("%v: unknown kind %v", fd.FullName(), fd.Kind()))
}
// NewExtensionType creates a new ExtensionType with the provided descriptor.
//
// Dynamic ExtensionTypes with the same descriptor compare as equal. That is,
// if xd1 == xd2, then NewExtensionType(xd1) == NewExtensionType(xd2).
//
// The InterfaceOf and ValueOf methods of the extension type are defined as:
//
// func (xt extensionType) ValueOf(iv interface{}) protoreflect.Value {
// return protoreflect.ValueOf(iv)
// }
//
// func (xt extensionType) InterfaceOf(v protoreflect.Value) interface{} {
// return v.Interface()
// }
//
// The Go type used by the proto.GetExtension and proto.SetExtension functions
// is determined by these methods, and is therefore equivalent to the Go type
// used to represent a protoreflect.Value. See the protoreflect.Value
// documentation for more details.
func NewExtensionType(desc pref.ExtensionDescriptor) pref.ExtensionType {
if xt, ok := desc.(pref.ExtensionTypeDescriptor); ok {
desc = xt.Descriptor()
}
return extensionType{extensionTypeDescriptor{desc}}
}
func (xt extensionType) New() pref.Value {
switch {
case xt.desc.IsMap():
return pref.ValueOfMap(&dynamicMap{
desc: xt.desc,
mapv: make(map[interface{}]pref.Value),
})
case xt.desc.IsList():
return pref.ValueOfList(&dynamicList{desc: xt.desc})
case xt.desc.Message() != nil:
return pref.ValueOfMessage(NewMessage(xt.desc.Message()))
default:
return xt.desc.Default()
}
}
func (xt extensionType) Zero() pref.Value {
switch {
case xt.desc.IsMap():
return pref.ValueOfMap(&dynamicMap{desc: xt.desc})
case xt.desc.Cardinality() == pref.Repeated:
return pref.ValueOfList(emptyList{desc: xt.desc})
case xt.desc.Message() != nil:
return pref.ValueOfMessage(&Message{typ: messageType{xt.desc.Message()}})
default:
return xt.desc.Default()
}
}
func (xt extensionType) TypeDescriptor() pref.ExtensionTypeDescriptor {
return xt.desc
}
func (xt extensionType) ValueOf(iv interface{}) pref.Value {
v := pref.ValueOf(iv)
typecheck(xt.desc, v)
return v
}
func (xt extensionType) InterfaceOf(v pref.Value) interface{} {
typecheck(xt.desc, v)
return v.Interface()
}
func (xt extensionType) IsValidInterface(iv interface{}) bool {
return typeIsValid(xt.desc, pref.ValueOf(iv)) == nil
}
func (xt extensionType) IsValidValue(v pref.Value) bool {
return typeIsValid(xt.desc, v) == nil
}
type extensionTypeDescriptor struct {
pref.ExtensionDescriptor
}
func (xt extensionTypeDescriptor) Type() pref.ExtensionType {
return extensionType{xt}
}
func (xt extensionTypeDescriptor) Descriptor() pref.ExtensionDescriptor {
return xt.ExtensionDescriptor
}

View File

@@ -0,0 +1,168 @@
// 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.
// source: google/protobuf/empty.proto
package emptypb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
// A generic empty message that you can re-use to avoid defining duplicated
// empty messages in your APIs. A typical example is to use it as the request
// or the response type of an API method. For instance:
//
// service Foo {
// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
// }
//
// The JSON representation for `Empty` is empty JSON object `{}`.
type Empty struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *Empty) Reset() {
*x = Empty{}
if protoimpl.UnsafeEnabled {
mi := &file_google_protobuf_empty_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Empty) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Empty) ProtoMessage() {}
func (x *Empty) ProtoReflect() protoreflect.Message {
mi := &file_google_protobuf_empty_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 Empty.ProtoReflect.Descriptor instead.
func (*Empty) Descriptor() ([]byte, []int) {
return file_google_protobuf_empty_proto_rawDescGZIP(), []int{0}
}
var File_google_protobuf_empty_proto protoreflect.FileDescriptor
var file_google_protobuf_empty_proto_rawDesc = []byte{
0x0a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x07,
0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x7d, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0a,
0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 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, 0x65, 0x6d, 0x70, 0x74, 0x79, 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_empty_proto_rawDescOnce sync.Once
file_google_protobuf_empty_proto_rawDescData = file_google_protobuf_empty_proto_rawDesc
)
func file_google_protobuf_empty_proto_rawDescGZIP() []byte {
file_google_protobuf_empty_proto_rawDescOnce.Do(func() {
file_google_protobuf_empty_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_empty_proto_rawDescData)
})
return file_google_protobuf_empty_proto_rawDescData
}
var file_google_protobuf_empty_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_google_protobuf_empty_proto_goTypes = []interface{}{
(*Empty)(nil), // 0: google.protobuf.Empty
}
var file_google_protobuf_empty_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_google_protobuf_empty_proto_init() }
func file_google_protobuf_empty_proto_init() {
if File_google_protobuf_empty_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_google_protobuf_empty_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Empty); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_google_protobuf_empty_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_google_protobuf_empty_proto_goTypes,
DependencyIndexes: file_google_protobuf_empty_proto_depIdxs,
MessageInfos: file_google_protobuf_empty_proto_msgTypes,
}.Build()
File_google_protobuf_empty_proto = out.File
file_google_protobuf_empty_proto_rawDesc = nil
file_google_protobuf_empty_proto_goTypes = nil
file_google_protobuf_empty_proto_depIdxs = nil
}

View File

@@ -0,0 +1,810 @@
// 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.
// 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"
)
// `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 that
// 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
}