mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
build: move e2e dependencies into e2e/go.mod
Several packages are only used while running the e2e suite. These packages are less important to update, as the they can not influence the final executable that is part of the Ceph-CSI container-image. By moving these dependencies out of the main Ceph-CSI go.mod, it is easier to identify if a reported CVE affects Ceph-CSI, or only the testing (like most of the Kubernetes CVEs). Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
committed by
mergify[bot]
parent
15da101b1b
commit
bec6090996
718
vendor/google.golang.org/protobuf/types/dynamicpb/dynamic.go
generated
vendored
718
vendor/google.golang.org/protobuf/types/dynamicpb/dynamic.go
generated
vendored
@ -1,718 +0,0 @@
|
||||
// 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"
|
||||
"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 protoreflect.EnumNumber
|
||||
typ protoreflect.EnumType
|
||||
}
|
||||
|
||||
func (e enum) Descriptor() protoreflect.EnumDescriptor { return e.typ.Descriptor() }
|
||||
func (e enum) Type() protoreflect.EnumType { return e.typ }
|
||||
func (e enum) Number() protoreflect.EnumNumber { return e.num }
|
||||
|
||||
// enumType is a dynamic protoreflect.EnumType.
|
||||
type enumType struct {
|
||||
desc protoreflect.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 protoreflect.EnumDescriptor) protoreflect.EnumType {
|
||||
return enumType{desc}
|
||||
}
|
||||
|
||||
func (et enumType) New(n protoreflect.EnumNumber) protoreflect.Enum { return enum{n, et} }
|
||||
func (et enumType) Descriptor() protoreflect.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 [google.golang.org/protobuf/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[protoreflect.FieldNumber]protoreflect.Value
|
||||
ext map[protoreflect.FieldNumber]protoreflect.FieldDescriptor
|
||||
unknown protoreflect.RawFields
|
||||
}
|
||||
|
||||
var (
|
||||
_ protoreflect.Message = (*Message)(nil)
|
||||
_ protoreflect.ProtoMessage = (*Message)(nil)
|
||||
_ protoiface.MessageV1 = (*Message)(nil)
|
||||
)
|
||||
|
||||
// NewMessage creates a new message with the provided descriptor.
|
||||
func NewMessage(desc protoreflect.MessageDescriptor) *Message {
|
||||
return &Message{
|
||||
typ: messageType{desc},
|
||||
known: make(map[protoreflect.FieldNumber]protoreflect.Value),
|
||||
ext: make(map[protoreflect.FieldNumber]protoreflect.FieldDescriptor),
|
||||
}
|
||||
}
|
||||
|
||||
// ProtoMessage implements the legacy message interface.
|
||||
func (m *Message) ProtoMessage() {}
|
||||
|
||||
// ProtoReflect implements the [protoreflect.ProtoMessage] interface.
|
||||
func (m *Message) ProtoReflect() protoreflect.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[protoreflect.FieldNumber]protoreflect.Value)
|
||||
m.ext = make(map[protoreflect.FieldNumber]protoreflect.FieldDescriptor)
|
||||
m.unknown = nil
|
||||
}
|
||||
|
||||
// Descriptor returns the message descriptor.
|
||||
func (m *Message) Descriptor() protoreflect.MessageDescriptor {
|
||||
return m.typ.desc
|
||||
}
|
||||
|
||||
// Type returns the message type.
|
||||
func (m *Message) Type() protoreflect.MessageType {
|
||||
return m.typ
|
||||
}
|
||||
|
||||
// New returns a newly allocated empty message with the same descriptor.
|
||||
// See [protoreflect.Message] for details.
|
||||
func (m *Message) New() protoreflect.Message {
|
||||
return m.Type().New()
|
||||
}
|
||||
|
||||
// Interface returns the message.
|
||||
// See [protoreflect.Message] for details.
|
||||
func (m *Message) Interface() protoreflect.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(protoreflect.FieldDescriptor, protoreflect.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 protoreflect.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 protoreflect.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 protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
m.checkField(fd)
|
||||
num := fd.Number()
|
||||
if fd.IsExtension() {
|
||||
if fd != m.ext[num] {
|
||||
return fd.(protoreflect.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 protoreflect.ValueOfMap(&dynamicMap{desc: fd})
|
||||
case fd.IsList():
|
||||
return protoreflect.ValueOfList(emptyList{desc: fd})
|
||||
case fd.Message() != nil:
|
||||
return protoreflect.ValueOfMessage(&Message{typ: messageType{fd.Message()}})
|
||||
case fd.Kind() == protoreflect.BytesKind:
|
||||
return protoreflect.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 protoreflect.FieldDescriptor) protoreflect.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.(protoreflect.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 protoreflect.FieldDescriptor, v protoreflect.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.(protoreflect.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 protoreflect.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 protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
m.checkField(fd)
|
||||
switch {
|
||||
case fd.IsExtension():
|
||||
return fd.(protoreflect.ExtensionTypeDescriptor).Type().New()
|
||||
case fd.IsMap():
|
||||
return protoreflect.ValueOfMap(&dynamicMap{
|
||||
desc: fd,
|
||||
mapv: make(map[any]protoreflect.Value),
|
||||
})
|
||||
case fd.IsList():
|
||||
return protoreflect.ValueOfList(&dynamicList{desc: fd})
|
||||
case fd.Message() != nil:
|
||||
return protoreflect.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 protoreflect.OneofDescriptor) protoreflect.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() protoreflect.RawFields {
|
||||
return m.unknown
|
||||
}
|
||||
|
||||
// SetUnknown sets the raw unknown fields.
|
||||
// See [protoreflect.Message] for details.
|
||||
func (m *Message) SetUnknown(r protoreflect.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 protoreflect.FieldDescriptor) {
|
||||
if fd.IsExtension() && fd.ContainingMessage().FullName() == m.Descriptor().FullName() {
|
||||
if _, ok := fd.(protoreflect.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 protoreflect.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 protoreflect.MessageDescriptor) protoreflect.MessageType {
|
||||
return messageType{desc}
|
||||
}
|
||||
|
||||
func (mt messageType) New() protoreflect.Message { return NewMessage(mt.desc) }
|
||||
func (mt messageType) Zero() protoreflect.Message { return &Message{typ: messageType{mt.desc}} }
|
||||
func (mt messageType) Descriptor() protoreflect.MessageDescriptor { return mt.desc }
|
||||
func (mt messageType) Enum(i int) protoreflect.EnumType {
|
||||
if ed := mt.desc.Fields().Get(i).Enum(); ed != nil {
|
||||
return NewEnumType(ed)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (mt messageType) Message(i int) protoreflect.MessageType {
|
||||
if md := mt.desc.Fields().Get(i).Message(); md != nil {
|
||||
return NewMessageType(md)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type emptyList struct {
|
||||
desc protoreflect.FieldDescriptor
|
||||
}
|
||||
|
||||
func (x emptyList) Len() int { return 0 }
|
||||
func (x emptyList) Get(n int) protoreflect.Value { panic(errors.New("out of range")) }
|
||||
func (x emptyList) Set(n int, v protoreflect.Value) {
|
||||
panic(errors.New("modification of immutable list"))
|
||||
}
|
||||
func (x emptyList) Append(v protoreflect.Value) { panic(errors.New("modification of immutable list")) }
|
||||
func (x emptyList) AppendMutable() protoreflect.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() protoreflect.Value { return newListEntry(x.desc) }
|
||||
func (x emptyList) IsValid() bool { return false }
|
||||
|
||||
type dynamicList struct {
|
||||
desc protoreflect.FieldDescriptor
|
||||
list []protoreflect.Value
|
||||
}
|
||||
|
||||
func (x *dynamicList) Len() int {
|
||||
return len(x.list)
|
||||
}
|
||||
|
||||
func (x *dynamicList) Get(n int) protoreflect.Value {
|
||||
return x.list[n]
|
||||
}
|
||||
|
||||
func (x *dynamicList) Set(n int, v protoreflect.Value) {
|
||||
typecheckSingular(x.desc, v)
|
||||
x.list[n] = v
|
||||
}
|
||||
|
||||
func (x *dynamicList) Append(v protoreflect.Value) {
|
||||
typecheckSingular(x.desc, v)
|
||||
x.list = append(x.list, v)
|
||||
}
|
||||
|
||||
func (x *dynamicList) AppendMutable() protoreflect.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] = protoreflect.Value{}
|
||||
}
|
||||
x.list = x.list[:n]
|
||||
}
|
||||
|
||||
func (x *dynamicList) NewElement() protoreflect.Value {
|
||||
return newListEntry(x.desc)
|
||||
}
|
||||
|
||||
func (x *dynamicList) IsValid() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
type dynamicMap struct {
|
||||
desc protoreflect.FieldDescriptor
|
||||
mapv map[any]protoreflect.Value
|
||||
}
|
||||
|
||||
func (x *dynamicMap) Get(k protoreflect.MapKey) protoreflect.Value { return x.mapv[k.Interface()] }
|
||||
func (x *dynamicMap) Set(k protoreflect.MapKey, v protoreflect.Value) {
|
||||
typecheckSingular(x.desc.MapKey(), k.Value())
|
||||
typecheckSingular(x.desc.MapValue(), v)
|
||||
x.mapv[k.Interface()] = v
|
||||
}
|
||||
func (x *dynamicMap) Has(k protoreflect.MapKey) bool { return x.Get(k).IsValid() }
|
||||
func (x *dynamicMap) Clear(k protoreflect.MapKey) { delete(x.mapv, k.Interface()) }
|
||||
func (x *dynamicMap) Mutable(k protoreflect.MapKey) protoreflect.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() protoreflect.Value {
|
||||
if md := x.desc.MapValue().Message(); md != nil {
|
||||
return protoreflect.ValueOfMessage(NewMessage(md).ProtoReflect())
|
||||
}
|
||||
return x.desc.MapValue().Default()
|
||||
}
|
||||
func (x *dynamicMap) IsValid() bool {
|
||||
return x.mapv != nil
|
||||
}
|
||||
|
||||
func (x *dynamicMap) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) {
|
||||
for k, v := range x.mapv {
|
||||
if !f(protoreflect.ValueOf(k).MapKey(), v) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func isSet(fd protoreflect.FieldDescriptor, v protoreflect.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.HasPresence() && !fd.IsExtension():
|
||||
switch fd.Kind() {
|
||||
case protoreflect.BoolKind:
|
||||
return v.Bool()
|
||||
case protoreflect.EnumKind:
|
||||
return v.Enum() != 0
|
||||
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed32Kind, protoreflect.Sfixed64Kind:
|
||||
return v.Int() != 0
|
||||
case protoreflect.Uint32Kind, protoreflect.Uint64Kind, protoreflect.Fixed32Kind, protoreflect.Fixed64Kind:
|
||||
return v.Uint() != 0
|
||||
case protoreflect.FloatKind, protoreflect.DoubleKind:
|
||||
return v.Float() != 0 || math.Signbit(v.Float())
|
||||
case protoreflect.StringKind:
|
||||
return v.String() != ""
|
||||
case protoreflect.BytesKind:
|
||||
return len(v.Bytes()) > 0
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func typecheck(fd protoreflect.FieldDescriptor, v protoreflect.Value) {
|
||||
if err := typeIsValid(fd, v); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func typeIsValid(fd protoreflect.FieldDescriptor, v protoreflect.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 protoreflect.FieldDescriptor, v protoreflect.Value) {
|
||||
if err := singularTypeIsValid(fd, v); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func singularTypeIsValid(fd protoreflect.FieldDescriptor, v protoreflect.Value) error {
|
||||
vi := v.Interface()
|
||||
var ok bool
|
||||
switch fd.Kind() {
|
||||
case protoreflect.BoolKind:
|
||||
_, ok = vi.(bool)
|
||||
case protoreflect.EnumKind:
|
||||
// We could check against the valid set of enum values, but do not.
|
||||
_, ok = vi.(protoreflect.EnumNumber)
|
||||
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||
_, ok = vi.(int32)
|
||||
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||
_, ok = vi.(uint32)
|
||||
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||
_, ok = vi.(int64)
|
||||
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||
_, ok = vi.(uint64)
|
||||
case protoreflect.FloatKind:
|
||||
_, ok = vi.(float32)
|
||||
case protoreflect.DoubleKind:
|
||||
_, ok = vi.(float64)
|
||||
case protoreflect.StringKind:
|
||||
_, ok = vi.(string)
|
||||
case protoreflect.BytesKind:
|
||||
_, ok = vi.([]byte)
|
||||
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||
var m protoreflect.Message
|
||||
m, ok = vi.(protoreflect.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 protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.Kind() {
|
||||
case protoreflect.BoolKind:
|
||||
return protoreflect.ValueOfBool(false)
|
||||
case protoreflect.EnumKind:
|
||||
return protoreflect.ValueOfEnum(fd.Enum().Values().Get(0).Number())
|
||||
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||
return protoreflect.ValueOfInt32(0)
|
||||
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||
return protoreflect.ValueOfUint32(0)
|
||||
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||
return protoreflect.ValueOfInt64(0)
|
||||
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||
return protoreflect.ValueOfUint64(0)
|
||||
case protoreflect.FloatKind:
|
||||
return protoreflect.ValueOfFloat32(0)
|
||||
case protoreflect.DoubleKind:
|
||||
return protoreflect.ValueOfFloat64(0)
|
||||
case protoreflect.StringKind:
|
||||
return protoreflect.ValueOfString("")
|
||||
case protoreflect.BytesKind:
|
||||
return protoreflect.ValueOfBytes(nil)
|
||||
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||
return protoreflect.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 any) protoreflect.Value {
|
||||
// return protoreflect.ValueOf(iv)
|
||||
// }
|
||||
//
|
||||
// func (xt extensionType) InterfaceOf(v protoreflect.Value) any {
|
||||
// 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 protoreflect.ExtensionDescriptor) protoreflect.ExtensionType {
|
||||
if xt, ok := desc.(protoreflect.ExtensionTypeDescriptor); ok {
|
||||
desc = xt.Descriptor()
|
||||
}
|
||||
return extensionType{extensionTypeDescriptor{desc}}
|
||||
}
|
||||
|
||||
func (xt extensionType) New() protoreflect.Value {
|
||||
switch {
|
||||
case xt.desc.IsMap():
|
||||
return protoreflect.ValueOfMap(&dynamicMap{
|
||||
desc: xt.desc,
|
||||
mapv: make(map[any]protoreflect.Value),
|
||||
})
|
||||
case xt.desc.IsList():
|
||||
return protoreflect.ValueOfList(&dynamicList{desc: xt.desc})
|
||||
case xt.desc.Message() != nil:
|
||||
return protoreflect.ValueOfMessage(NewMessage(xt.desc.Message()))
|
||||
default:
|
||||
return xt.desc.Default()
|
||||
}
|
||||
}
|
||||
|
||||
func (xt extensionType) Zero() protoreflect.Value {
|
||||
switch {
|
||||
case xt.desc.IsMap():
|
||||
return protoreflect.ValueOfMap(&dynamicMap{desc: xt.desc})
|
||||
case xt.desc.Cardinality() == protoreflect.Repeated:
|
||||
return protoreflect.ValueOfList(emptyList{desc: xt.desc})
|
||||
case xt.desc.Message() != nil:
|
||||
return protoreflect.ValueOfMessage(&Message{typ: messageType{xt.desc.Message()}})
|
||||
default:
|
||||
return xt.desc.Default()
|
||||
}
|
||||
}
|
||||
|
||||
func (xt extensionType) TypeDescriptor() protoreflect.ExtensionTypeDescriptor {
|
||||
return xt.desc
|
||||
}
|
||||
|
||||
func (xt extensionType) ValueOf(iv any) protoreflect.Value {
|
||||
v := protoreflect.ValueOf(iv)
|
||||
typecheck(xt.desc, v)
|
||||
return v
|
||||
}
|
||||
|
||||
func (xt extensionType) InterfaceOf(v protoreflect.Value) any {
|
||||
typecheck(xt.desc, v)
|
||||
return v.Interface()
|
||||
}
|
||||
|
||||
func (xt extensionType) IsValidInterface(iv any) bool {
|
||||
return typeIsValid(xt.desc, protoreflect.ValueOf(iv)) == nil
|
||||
}
|
||||
|
||||
func (xt extensionType) IsValidValue(v protoreflect.Value) bool {
|
||||
return typeIsValid(xt.desc, v) == nil
|
||||
}
|
||||
|
||||
type extensionTypeDescriptor struct {
|
||||
protoreflect.ExtensionDescriptor
|
||||
}
|
||||
|
||||
func (xt extensionTypeDescriptor) Type() protoreflect.ExtensionType {
|
||||
return extensionType{xt}
|
||||
}
|
||||
|
||||
func (xt extensionTypeDescriptor) Descriptor() protoreflect.ExtensionDescriptor {
|
||||
return xt.ExtensionDescriptor
|
||||
}
|
180
vendor/google.golang.org/protobuf/types/dynamicpb/types.go
generated
vendored
180
vendor/google.golang.org/protobuf/types/dynamicpb/types.go
generated
vendored
@ -1,180 +0,0 @@
|
||||
// Copyright 2023 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
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"google.golang.org/protobuf/internal/errors"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
)
|
||||
|
||||
type extField struct {
|
||||
name protoreflect.FullName
|
||||
number protoreflect.FieldNumber
|
||||
}
|
||||
|
||||
// A Types is a collection of dynamically constructed descriptors.
|
||||
// Its methods are safe for concurrent use.
|
||||
//
|
||||
// Types implements [protoregistry.MessageTypeResolver] and [protoregistry.ExtensionTypeResolver].
|
||||
// A Types may be used as a [google.golang.org/protobuf/proto.UnmarshalOptions.Resolver].
|
||||
type Types struct {
|
||||
// atomicExtFiles is used with sync/atomic and hence must be the first word
|
||||
// of the struct to guarantee 64-bit alignment.
|
||||
atomicExtFiles atomic.Uint64
|
||||
extMu sync.Mutex
|
||||
|
||||
files *protoregistry.Files
|
||||
|
||||
extensionsByMessage map[extField]protoreflect.ExtensionDescriptor
|
||||
}
|
||||
|
||||
// NewTypes creates a new Types registry with the provided files.
|
||||
// The Files registry is retained, and changes to Files will be reflected in Types.
|
||||
// It is not safe to concurrently change the Files while calling Types methods.
|
||||
func NewTypes(f *protoregistry.Files) *Types {
|
||||
return &Types{
|
||||
files: f,
|
||||
}
|
||||
}
|
||||
|
||||
// FindEnumByName looks up an enum by its full name;
|
||||
// e.g., "google.protobuf.Field.Kind".
|
||||
//
|
||||
// This returns (nil, [protoregistry.NotFound]) if not found.
|
||||
func (t *Types) FindEnumByName(name protoreflect.FullName) (protoreflect.EnumType, error) {
|
||||
d, err := t.files.FindDescriptorByName(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ed, ok := d.(protoreflect.EnumDescriptor)
|
||||
if !ok {
|
||||
return nil, errors.New("found wrong type: got %v, want enum", descName(d))
|
||||
}
|
||||
return NewEnumType(ed), nil
|
||||
}
|
||||
|
||||
// FindExtensionByName looks up an extension field by the field's full name.
|
||||
// Note that this is the full name of the field as determined by
|
||||
// where the extension is declared and is unrelated to the full name of the
|
||||
// message being extended.
|
||||
//
|
||||
// This returns (nil, [protoregistry.NotFound]) if not found.
|
||||
func (t *Types) FindExtensionByName(name protoreflect.FullName) (protoreflect.ExtensionType, error) {
|
||||
d, err := t.files.FindDescriptorByName(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
xd, ok := d.(protoreflect.ExtensionDescriptor)
|
||||
if !ok {
|
||||
return nil, errors.New("found wrong type: got %v, want extension", descName(d))
|
||||
}
|
||||
return NewExtensionType(xd), nil
|
||||
}
|
||||
|
||||
// FindExtensionByNumber looks up an extension field by the field number
|
||||
// within some parent message, identified by full name.
|
||||
//
|
||||
// This returns (nil, [protoregistry.NotFound]) if not found.
|
||||
func (t *Types) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) {
|
||||
// Construct the extension number map lazily, since not every user will need it.
|
||||
// Update the map if new files are added to the registry.
|
||||
if t.atomicExtFiles.Load() != uint64(t.files.NumFiles()) {
|
||||
t.updateExtensions()
|
||||
}
|
||||
xd := t.extensionsByMessage[extField{message, field}]
|
||||
if xd == nil {
|
||||
return nil, protoregistry.NotFound
|
||||
}
|
||||
return NewExtensionType(xd), nil
|
||||
}
|
||||
|
||||
// FindMessageByName looks up a message by its full name;
|
||||
// e.g. "google.protobuf.Any".
|
||||
//
|
||||
// This returns (nil, [protoregistry.NotFound]) if not found.
|
||||
func (t *Types) FindMessageByName(name protoreflect.FullName) (protoreflect.MessageType, error) {
|
||||
d, err := t.files.FindDescriptorByName(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
md, ok := d.(protoreflect.MessageDescriptor)
|
||||
if !ok {
|
||||
return nil, errors.New("found wrong type: got %v, want message", descName(d))
|
||||
}
|
||||
return NewMessageType(md), nil
|
||||
}
|
||||
|
||||
// FindMessageByURL looks up a message by a URL identifier.
|
||||
// See documentation on google.protobuf.Any.type_url for the URL format.
|
||||
//
|
||||
// This returns (nil, [protoregistry.NotFound]) if not found.
|
||||
func (t *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) {
|
||||
// This function is similar to FindMessageByName but
|
||||
// truncates anything before and including '/' in the URL.
|
||||
message := protoreflect.FullName(url)
|
||||
if i := strings.LastIndexByte(url, '/'); i >= 0 {
|
||||
message = message[i+len("/"):]
|
||||
}
|
||||
return t.FindMessageByName(message)
|
||||
}
|
||||
|
||||
func (t *Types) updateExtensions() {
|
||||
t.extMu.Lock()
|
||||
defer t.extMu.Unlock()
|
||||
if t.atomicExtFiles.Load() == uint64(t.files.NumFiles()) {
|
||||
return
|
||||
}
|
||||
defer t.atomicExtFiles.Store(uint64(t.files.NumFiles()))
|
||||
t.files.RangeFiles(func(fd protoreflect.FileDescriptor) bool {
|
||||
t.registerExtensions(fd.Extensions())
|
||||
t.registerExtensionsInMessages(fd.Messages())
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
func (t *Types) registerExtensionsInMessages(mds protoreflect.MessageDescriptors) {
|
||||
count := mds.Len()
|
||||
for i := 0; i < count; i++ {
|
||||
md := mds.Get(i)
|
||||
t.registerExtensions(md.Extensions())
|
||||
t.registerExtensionsInMessages(md.Messages())
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Types) registerExtensions(xds protoreflect.ExtensionDescriptors) {
|
||||
count := xds.Len()
|
||||
for i := 0; i < count; i++ {
|
||||
xd := xds.Get(i)
|
||||
field := xd.Number()
|
||||
message := xd.ContainingMessage().FullName()
|
||||
if t.extensionsByMessage == nil {
|
||||
t.extensionsByMessage = make(map[extField]protoreflect.ExtensionDescriptor)
|
||||
}
|
||||
t.extensionsByMessage[extField{message, field}] = xd
|
||||
}
|
||||
}
|
||||
|
||||
func descName(d protoreflect.Descriptor) string {
|
||||
switch d.(type) {
|
||||
case protoreflect.EnumDescriptor:
|
||||
return "enum"
|
||||
case protoreflect.EnumValueDescriptor:
|
||||
return "enum value"
|
||||
case protoreflect.MessageDescriptor:
|
||||
return "message"
|
||||
case protoreflect.ExtensionDescriptor:
|
||||
return "extension"
|
||||
case protoreflect.ServiceDescriptor:
|
||||
return "service"
|
||||
default:
|
||||
return fmt.Sprintf("%T", d)
|
||||
}
|
||||
}
|
150
vendor/google.golang.org/protobuf/types/known/emptypb/empty.pb.go
generated
vendored
150
vendor/google.golang.org/protobuf/types/known/emptypb/empty.pb.go
generated
vendored
@ -1,150 +0,0 @@
|
||||
// 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"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
// 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);
|
||||
// }
|
||||
type Empty struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Empty) Reset() {
|
||||
*x = Empty{}
|
||||
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 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 = string([]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 []byte
|
||||
)
|
||||
|
||||
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(unsafe.Slice(unsafe.StringData(file_google_protobuf_empty_proto_rawDesc), len(file_google_protobuf_empty_proto_rawDesc)))
|
||||
})
|
||||
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 = []any{
|
||||
(*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
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_protobuf_empty_proto_rawDesc), len(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_goTypes = nil
|
||||
file_google_protobuf_empty_proto_depIdxs = nil
|
||||
}
|
571
vendor/google.golang.org/protobuf/types/known/fieldmaskpb/field_mask.pb.go
generated
vendored
571
vendor/google.golang.org/protobuf/types/known/fieldmaskpb/field_mask.pb.go
generated
vendored
@ -1,571 +0,0 @@
|
||||
// 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/field_mask.proto
|
||||
|
||||
// Package fieldmaskpb contains generated types for google/protobuf/field_mask.proto.
|
||||
//
|
||||
// The FieldMask message represents a set of symbolic field paths.
|
||||
// The paths are specific to some target message type,
|
||||
// which is not stored within the FieldMask message itself.
|
||||
//
|
||||
// # Constructing a FieldMask
|
||||
//
|
||||
// The New function is used construct a FieldMask:
|
||||
//
|
||||
// var messageType *descriptorpb.DescriptorProto
|
||||
// fm, err := fieldmaskpb.New(messageType, "field.name", "field.number")
|
||||
// if err != nil {
|
||||
// ... // handle error
|
||||
// }
|
||||
// ... // make use of fm
|
||||
//
|
||||
// The "field.name" and "field.number" paths are valid paths according to the
|
||||
// google.protobuf.DescriptorProto message. Use of a path that does not correlate
|
||||
// to valid fields reachable from DescriptorProto would result in an error.
|
||||
//
|
||||
// Once a FieldMask message has been constructed,
|
||||
// the Append method can be used to insert additional paths to the path set:
|
||||
//
|
||||
// var messageType *descriptorpb.DescriptorProto
|
||||
// if err := fm.Append(messageType, "options"); err != nil {
|
||||
// ... // handle error
|
||||
// }
|
||||
//
|
||||
// # Type checking a FieldMask
|
||||
//
|
||||
// In order to verify that a FieldMask represents a set of fields that are
|
||||
// reachable from some target message type, use the IsValid method:
|
||||
//
|
||||
// var messageType *descriptorpb.DescriptorProto
|
||||
// if fm.IsValid(messageType) {
|
||||
// ... // make use of fm
|
||||
// }
|
||||
//
|
||||
// IsValid needs to be passed the target message type as an input since the
|
||||
// FieldMask message itself does not store the message type that the set of paths
|
||||
// are for.
|
||||
package fieldmaskpb
|
||||
|
||||
import (
|
||||
proto "google.golang.org/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sort "sort"
|
||||
strings "strings"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
// `FieldMask` represents a set of symbolic field paths, for example:
|
||||
//
|
||||
// paths: "f.a"
|
||||
// paths: "f.b.d"
|
||||
//
|
||||
// Here `f` represents a field in some root message, `a` and `b`
|
||||
// fields in the message found in `f`, and `d` a field found in the
|
||||
// message in `f.b`.
|
||||
//
|
||||
// Field masks are used to specify a subset of fields that should be
|
||||
// returned by a get operation or modified by an update operation.
|
||||
// Field masks also have a custom JSON encoding (see below).
|
||||
//
|
||||
// # Field Masks in Projections
|
||||
//
|
||||
// When used in the context of a projection, a response message or
|
||||
// sub-message is filtered by the API to only contain those fields as
|
||||
// specified in the mask. For example, if the mask in the previous
|
||||
// example is applied to a response message as follows:
|
||||
//
|
||||
// f {
|
||||
// a : 22
|
||||
// b {
|
||||
// d : 1
|
||||
// x : 2
|
||||
// }
|
||||
// y : 13
|
||||
// }
|
||||
// z: 8
|
||||
//
|
||||
// The result will not contain specific values for fields x,y and z
|
||||
// (their value will be set to the default, and omitted in proto text
|
||||
// output):
|
||||
//
|
||||
// f {
|
||||
// a : 22
|
||||
// b {
|
||||
// d : 1
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// A repeated field is not allowed except at the last position of a
|
||||
// paths string.
|
||||
//
|
||||
// If a FieldMask object is not present in a get operation, the
|
||||
// operation applies to all fields (as if a FieldMask of all fields
|
||||
// had been specified).
|
||||
//
|
||||
// Note that a field mask does not necessarily apply to the
|
||||
// top-level response message. In case of a REST get operation, the
|
||||
// field mask applies directly to the response, but in case of a REST
|
||||
// list operation, the mask instead applies to each individual message
|
||||
// in the returned resource list. In case of a REST custom method,
|
||||
// other definitions may be used. Where the mask applies will be
|
||||
// clearly documented together with its declaration in the API. In
|
||||
// any case, the effect on the returned resource/resources is required
|
||||
// behavior for APIs.
|
||||
//
|
||||
// # Field Masks in Update Operations
|
||||
//
|
||||
// A field mask in update operations specifies which fields of the
|
||||
// targeted resource are going to be updated. The API is required
|
||||
// to only change the values of the fields as specified in the mask
|
||||
// and leave the others untouched. If a resource is passed in to
|
||||
// describe the updated values, the API ignores the values of all
|
||||
// fields not covered by the mask.
|
||||
//
|
||||
// If a repeated field is specified for an update operation, new values will
|
||||
// be appended to the existing repeated field in the target resource. Note that
|
||||
// a repeated field is only allowed in the last position of a `paths` string.
|
||||
//
|
||||
// If a sub-message is specified in the last position of the field mask for an
|
||||
// update operation, then new value will be merged into the existing sub-message
|
||||
// in the target resource.
|
||||
//
|
||||
// For example, given the target message:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d: 1
|
||||
// x: 2
|
||||
// }
|
||||
// c: [1]
|
||||
// }
|
||||
//
|
||||
// And an update message:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d: 10
|
||||
// }
|
||||
// c: [2]
|
||||
// }
|
||||
//
|
||||
// then if the field mask is:
|
||||
//
|
||||
// paths: ["f.b", "f.c"]
|
||||
//
|
||||
// then the result will be:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d: 10
|
||||
// x: 2
|
||||
// }
|
||||
// c: [1, 2]
|
||||
// }
|
||||
//
|
||||
// An implementation may provide options to override this default behavior for
|
||||
// repeated and message fields.
|
||||
//
|
||||
// In order to reset a field's value to the default, the field must
|
||||
// be in the mask and set to the default value in the provided resource.
|
||||
// Hence, in order to reset all fields of a resource, provide a default
|
||||
// instance of the resource and set all fields in the mask, or do
|
||||
// not provide a mask as described below.
|
||||
//
|
||||
// If a field mask is not present on update, the operation applies to
|
||||
// all fields (as if a field mask of all fields has been specified).
|
||||
// Note that in the presence of schema evolution, this may mean that
|
||||
// fields the client does not know and has therefore not filled into
|
||||
// the request will be reset to their default. If this is unwanted
|
||||
// behavior, a specific service may require a client to always specify
|
||||
// a field mask, producing an error if not.
|
||||
//
|
||||
// As with get operations, the location of the resource which
|
||||
// describes the updated values in the request message depends on the
|
||||
// operation kind. In any case, the effect of the field mask is
|
||||
// required to be honored by the API.
|
||||
//
|
||||
// ## Considerations for HTTP REST
|
||||
//
|
||||
// The HTTP kind of an update operation which uses a field mask must
|
||||
// be set to PATCH instead of PUT in order to satisfy HTTP semantics
|
||||
// (PUT must only be used for full updates).
|
||||
//
|
||||
// # JSON Encoding of Field Masks
|
||||
//
|
||||
// In JSON, a field mask is encoded as a single string where paths are
|
||||
// separated by a comma. Fields name in each path are converted
|
||||
// to/from lower-camel naming conventions.
|
||||
//
|
||||
// As an example, consider the following message declarations:
|
||||
//
|
||||
// message Profile {
|
||||
// User user = 1;
|
||||
// Photo photo = 2;
|
||||
// }
|
||||
// message User {
|
||||
// string display_name = 1;
|
||||
// string address = 2;
|
||||
// }
|
||||
//
|
||||
// In proto a field mask for `Profile` may look as such:
|
||||
//
|
||||
// mask {
|
||||
// paths: "user.display_name"
|
||||
// paths: "photo"
|
||||
// }
|
||||
//
|
||||
// In JSON, the same mask is represented as below:
|
||||
//
|
||||
// {
|
||||
// mask: "user.displayName,photo"
|
||||
// }
|
||||
//
|
||||
// # Field Masks and Oneof Fields
|
||||
//
|
||||
// Field masks treat fields in oneofs just as regular fields. Consider the
|
||||
// following message:
|
||||
//
|
||||
// message SampleMessage {
|
||||
// oneof test_oneof {
|
||||
// string name = 4;
|
||||
// SubMessage sub_message = 9;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// The field mask can be:
|
||||
//
|
||||
// mask {
|
||||
// paths: "name"
|
||||
// }
|
||||
//
|
||||
// Or:
|
||||
//
|
||||
// mask {
|
||||
// paths: "sub_message"
|
||||
// }
|
||||
//
|
||||
// Note that oneof type names ("test_oneof" in this case) cannot be used in
|
||||
// paths.
|
||||
//
|
||||
// ## Field Mask Verification
|
||||
//
|
||||
// The implementation of any API method which has a FieldMask type field in the
|
||||
// request should verify the included field paths, and return an
|
||||
// `INVALID_ARGUMENT` error if any path is unmappable.
|
||||
type FieldMask struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// The set of field mask paths.
|
||||
Paths []string `protobuf:"bytes,1,rep,name=paths,proto3" json:"paths,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
// New constructs a field mask from a list of paths and verifies that
|
||||
// each one is valid according to the specified message type.
|
||||
func New(m proto.Message, paths ...string) (*FieldMask, error) {
|
||||
x := new(FieldMask)
|
||||
return x, x.Append(m, paths...)
|
||||
}
|
||||
|
||||
// Union returns the union of all the paths in the input field masks.
|
||||
func Union(mx *FieldMask, my *FieldMask, ms ...*FieldMask) *FieldMask {
|
||||
var out []string
|
||||
out = append(out, mx.GetPaths()...)
|
||||
out = append(out, my.GetPaths()...)
|
||||
for _, m := range ms {
|
||||
out = append(out, m.GetPaths()...)
|
||||
}
|
||||
return &FieldMask{Paths: normalizePaths(out)}
|
||||
}
|
||||
|
||||
// Intersect returns the intersection of all the paths in the input field masks.
|
||||
func Intersect(mx *FieldMask, my *FieldMask, ms ...*FieldMask) *FieldMask {
|
||||
var ss1, ss2 []string // reused buffers for performance
|
||||
intersect := func(out, in []string) []string {
|
||||
ss1 = normalizePaths(append(ss1[:0], in...))
|
||||
ss2 = normalizePaths(append(ss2[:0], out...))
|
||||
out = out[:0]
|
||||
for i1, i2 := 0, 0; i1 < len(ss1) && i2 < len(ss2); {
|
||||
switch s1, s2 := ss1[i1], ss2[i2]; {
|
||||
case hasPathPrefix(s1, s2):
|
||||
out = append(out, s1)
|
||||
i1++
|
||||
case hasPathPrefix(s2, s1):
|
||||
out = append(out, s2)
|
||||
i2++
|
||||
case lessPath(s1, s2):
|
||||
i1++
|
||||
case lessPath(s2, s1):
|
||||
i2++
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
out := Union(mx, my, ms...).GetPaths()
|
||||
out = intersect(out, mx.GetPaths())
|
||||
out = intersect(out, my.GetPaths())
|
||||
for _, m := range ms {
|
||||
out = intersect(out, m.GetPaths())
|
||||
}
|
||||
return &FieldMask{Paths: normalizePaths(out)}
|
||||
}
|
||||
|
||||
// IsValid reports whether all the paths are syntactically valid and
|
||||
// refer to known fields in the specified message type.
|
||||
// It reports false for a nil FieldMask.
|
||||
func (x *FieldMask) IsValid(m proto.Message) bool {
|
||||
paths := x.GetPaths()
|
||||
return x != nil && numValidPaths(m, paths) == len(paths)
|
||||
}
|
||||
|
||||
// Append appends a list of paths to the mask and verifies that each one
|
||||
// is valid according to the specified message type.
|
||||
// An invalid path is not appended and breaks insertion of subsequent paths.
|
||||
func (x *FieldMask) Append(m proto.Message, paths ...string) error {
|
||||
numValid := numValidPaths(m, paths)
|
||||
x.Paths = append(x.Paths, paths[:numValid]...)
|
||||
paths = paths[numValid:]
|
||||
if len(paths) > 0 {
|
||||
name := m.ProtoReflect().Descriptor().FullName()
|
||||
return protoimpl.X.NewError("invalid path %q for message %q", paths[0], name)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func numValidPaths(m proto.Message, paths []string) int {
|
||||
md0 := m.ProtoReflect().Descriptor()
|
||||
for i, path := range paths {
|
||||
md := md0
|
||||
if !rangeFields(path, func(field string) bool {
|
||||
// Search the field within the message.
|
||||
if md == nil {
|
||||
return false // not within a message
|
||||
}
|
||||
fd := md.Fields().ByName(protoreflect.Name(field))
|
||||
// The real field name of a group is the message name.
|
||||
if fd == nil {
|
||||
gd := md.Fields().ByName(protoreflect.Name(strings.ToLower(field)))
|
||||
if gd != nil && gd.Kind() == protoreflect.GroupKind && string(gd.Message().Name()) == field {
|
||||
fd = gd
|
||||
}
|
||||
} else if fd.Kind() == protoreflect.GroupKind && string(fd.Message().Name()) != field {
|
||||
fd = nil
|
||||
}
|
||||
if fd == nil {
|
||||
return false // message has does not have this field
|
||||
}
|
||||
|
||||
// Identify the next message to search within.
|
||||
md = fd.Message() // may be nil
|
||||
|
||||
// Repeated fields are only allowed at the last position.
|
||||
if fd.IsList() || fd.IsMap() {
|
||||
md = nil
|
||||
}
|
||||
|
||||
return true
|
||||
}) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return len(paths)
|
||||
}
|
||||
|
||||
// Normalize converts the mask to its canonical form where all paths are sorted
|
||||
// and redundant paths are removed.
|
||||
func (x *FieldMask) Normalize() {
|
||||
x.Paths = normalizePaths(x.Paths)
|
||||
}
|
||||
|
||||
func normalizePaths(paths []string) []string {
|
||||
sort.Slice(paths, func(i, j int) bool {
|
||||
return lessPath(paths[i], paths[j])
|
||||
})
|
||||
|
||||
// Elide any path that is a prefix match on the previous.
|
||||
out := paths[:0]
|
||||
for _, path := range paths {
|
||||
if len(out) > 0 && hasPathPrefix(path, out[len(out)-1]) {
|
||||
continue
|
||||
}
|
||||
out = append(out, path)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// hasPathPrefix is like strings.HasPrefix, but further checks for either
|
||||
// an exact matche or that the prefix is delimited by a dot.
|
||||
func hasPathPrefix(path, prefix string) bool {
|
||||
return strings.HasPrefix(path, prefix) && (len(path) == len(prefix) || path[len(prefix)] == '.')
|
||||
}
|
||||
|
||||
// lessPath is a lexicographical comparison where dot is specially treated
|
||||
// as the smallest symbol.
|
||||
func lessPath(x, y string) bool {
|
||||
for i := 0; i < len(x) && i < len(y); i++ {
|
||||
if x[i] != y[i] {
|
||||
return (x[i] - '.') < (y[i] - '.')
|
||||
}
|
||||
}
|
||||
return len(x) < len(y)
|
||||
}
|
||||
|
||||
// rangeFields is like strings.Split(path, "."), but avoids allocations by
|
||||
// iterating over each field in place and calling a iterator function.
|
||||
func rangeFields(path string, f func(field string) bool) bool {
|
||||
for {
|
||||
var field string
|
||||
if i := strings.IndexByte(path, '.'); i >= 0 {
|
||||
field, path = path[:i], path[i:]
|
||||
} else {
|
||||
field, path = path, ""
|
||||
}
|
||||
|
||||
if !f(field) {
|
||||
return false
|
||||
}
|
||||
|
||||
if len(path) == 0 {
|
||||
return true
|
||||
}
|
||||
path = strings.TrimPrefix(path, ".")
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FieldMask) Reset() {
|
||||
*x = FieldMask{}
|
||||
mi := &file_google_protobuf_field_mask_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *FieldMask) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FieldMask) ProtoMessage() {}
|
||||
|
||||
func (x *FieldMask) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_google_protobuf_field_mask_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FieldMask.ProtoReflect.Descriptor instead.
|
||||
func (*FieldMask) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_field_mask_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *FieldMask) GetPaths() []string {
|
||||
if x != nil {
|
||||
return x.Paths
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_google_protobuf_field_mask_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_google_protobuf_field_mask_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||
0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x75, 0x66, 0x22, 0x21, 0x0a, 0x09, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b,
|
||||
0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52,
|
||||
0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x42, 0x85, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67,
|
||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0e,
|
||||
0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
|
||||
0x5a, 0x32, 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, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x6d, 0x61,
|
||||
0x73, 0x6b, 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_field_mask_proto_rawDescOnce sync.Once
|
||||
file_google_protobuf_field_mask_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_google_protobuf_field_mask_proto_rawDescGZIP() []byte {
|
||||
file_google_protobuf_field_mask_proto_rawDescOnce.Do(func() {
|
||||
file_google_protobuf_field_mask_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_google_protobuf_field_mask_proto_rawDesc), len(file_google_protobuf_field_mask_proto_rawDesc)))
|
||||
})
|
||||
return file_google_protobuf_field_mask_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_google_protobuf_field_mask_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_google_protobuf_field_mask_proto_goTypes = []any{
|
||||
(*FieldMask)(nil), // 0: google.protobuf.FieldMask
|
||||
}
|
||||
var file_google_protobuf_field_mask_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_field_mask_proto_init() }
|
||||
func file_google_protobuf_field_mask_proto_init() {
|
||||
if File_google_protobuf_field_mask_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_protobuf_field_mask_proto_rawDesc), len(file_google_protobuf_field_mask_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_google_protobuf_field_mask_proto_goTypes,
|
||||
DependencyIndexes: file_google_protobuf_field_mask_proto_depIdxs,
|
||||
MessageInfos: file_google_protobuf_field_mask_proto_msgTypes,
|
||||
}.Build()
|
||||
File_google_protobuf_field_mask_proto = out.File
|
||||
file_google_protobuf_field_mask_proto_goTypes = nil
|
||||
file_google_protobuf_field_mask_proto_depIdxs = nil
|
||||
}
|
791
vendor/google.golang.org/protobuf/types/known/structpb/struct.pb.go
generated
vendored
791
vendor/google.golang.org/protobuf/types/known/structpb/struct.pb.go
generated
vendored
@ -1,791 +0,0 @@
|
||||
// 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 any, map[string]any, and []any.
|
||||
// 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 any, map[string]any, and []any
|
||||
// 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]any{
|
||||
// "firstName": "John",
|
||||
// "lastName": "Smith",
|
||||
// "isAlive": true,
|
||||
// "age": 27,
|
||||
// "address": map[string]any{
|
||||
// "streetAddress": "21 2nd Street",
|
||||
// "city": "New York",
|
||||
// "state": "NY",
|
||||
// "postalCode": "10021-3100",
|
||||
// },
|
||||
// "phoneNumbers": []any{
|
||||
// map[string]any{
|
||||
// "type": "home",
|
||||
// "number": "212 555-1234",
|
||||
// },
|
||||
// map[string]any{
|
||||
// "type": "office",
|
||||
// "number": "646 555-4567",
|
||||
// },
|
||||
// },
|
||||
// "children": []any{},
|
||||
// "spouse": nil,
|
||||
// })
|
||||
// if err != nil {
|
||||
// ... // handle error
|
||||
// }
|
||||
// ... // make use of m as a *structpb.Value
|
||||
package structpb
|
||||
|
||||
import (
|
||||
base64 "encoding/base64"
|
||||
json "encoding/json"
|
||||
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"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
// `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 `protogen:"open.v1"`
|
||||
// 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" protobuf_val:"bytes,2,opt,name=value"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
// 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]any) (*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]any {
|
||||
f := x.GetFields()
|
||||
vs := make(map[string]any, len(f))
|
||||
for k, v := range f {
|
||||
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{}
|
||||
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 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 `protogen:"open.v1"`
|
||||
// The kind of value.
|
||||
//
|
||||
// Types that are valid to be assigned to Kind:
|
||||
//
|
||||
// *Value_NullValue
|
||||
// *Value_NumberValue
|
||||
// *Value_StringValue
|
||||
// *Value_BoolValue
|
||||
// *Value_StructValue
|
||||
// *Value_ListValue
|
||||
Kind isValue_Kind `protobuf_oneof:"kind"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
// NewValue constructs a Value from a general-purpose Go interface.
|
||||
//
|
||||
// ╔═══════════════════════════════════════╤════════════════════════════════════════════╗
|
||||
// ║ Go type │ Conversion ║
|
||||
// ╠═══════════════════════════════════════╪════════════════════════════════════════════╣
|
||||
// ║ nil │ stored as NullValue ║
|
||||
// ║ bool │ stored as BoolValue ║
|
||||
// ║ int, int8, int16, int32, int64 │ stored as NumberValue ║
|
||||
// ║ uint, uint8, uint16, uint32, uint64 │ stored as NumberValue ║
|
||||
// ║ float32, float64 │ stored as NumberValue ║
|
||||
// ║ json.Number │ stored as NumberValue ║
|
||||
// ║ string │ stored as StringValue; must be valid UTF-8 ║
|
||||
// ║ []byte │ stored as StringValue; base64-encoded ║
|
||||
// ║ map[string]any │ stored as StructValue ║
|
||||
// ║ []any │ 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 any) (*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 int8:
|
||||
return NewNumberValue(float64(v)), nil
|
||||
case int16:
|
||||
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 uint8:
|
||||
return NewNumberValue(float64(v)), nil
|
||||
case uint16:
|
||||
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 json.Number:
|
||||
n, err := v.Float64()
|
||||
if err != nil {
|
||||
return nil, protoimpl.X.NewError("invalid number format %q, expected a float64: %v", v, err)
|
||||
}
|
||||
return NewNumberValue(n), 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]any:
|
||||
v2, err := NewStruct(v)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewStructValue(v2), nil
|
||||
case []any:
|
||||
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() any {
|
||||
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{}
|
||||
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 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 (x *Value) GetKind() isValue_Kind {
|
||||
if x != nil {
|
||||
return x.Kind
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Value) GetNullValue() NullValue {
|
||||
if x != nil {
|
||||
if x, ok := x.Kind.(*Value_NullValue); ok {
|
||||
return x.NullValue
|
||||
}
|
||||
}
|
||||
return NullValue_NULL_VALUE
|
||||
}
|
||||
|
||||
func (x *Value) GetNumberValue() float64 {
|
||||
if x != nil {
|
||||
if x, ok := x.Kind.(*Value_NumberValue); ok {
|
||||
return x.NumberValue
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Value) GetStringValue() string {
|
||||
if x != nil {
|
||||
if x, ok := x.Kind.(*Value_StringValue); ok {
|
||||
return x.StringValue
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Value) GetBoolValue() bool {
|
||||
if x != nil {
|
||||
if x, ok := x.Kind.(*Value_BoolValue); ok {
|
||||
return x.BoolValue
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *Value) GetStructValue() *Struct {
|
||||
if x != nil {
|
||||
if x, ok := x.Kind.(*Value_StructValue); ok {
|
||||
return x.StructValue
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Value) GetListValue() *ListValue {
|
||||
if x != nil {
|
||||
if x, ok := x.Kind.(*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 `protogen:"open.v1"`
|
||||
// Repeated field of dynamically typed values.
|
||||
Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
// NewList constructs a ListValue from a general-purpose Go slice.
|
||||
// The slice elements are converted using NewValue.
|
||||
func NewList(v []any) (*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() []any {
|
||||
vals := x.GetValues()
|
||||
vs := make([]any, len(vals))
|
||||
for i, v := range vals {
|
||||
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{}
|
||||
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 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 = string([]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 []byte
|
||||
)
|
||||
|
||||
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(unsafe.Slice(unsafe.StringData(file_google_protobuf_struct_proto_rawDesc), len(file_google_protobuf_struct_proto_rawDesc)))
|
||||
})
|
||||
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 = []any{
|
||||
(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
|
||||
}
|
||||
file_google_protobuf_struct_proto_msgTypes[1].OneofWrappers = []any{
|
||||
(*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: unsafe.Slice(unsafe.StringData(file_google_protobuf_struct_proto_rawDesc), len(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_goTypes = nil
|
||||
file_google_protobuf_struct_proto_depIdxs = nil
|
||||
}
|
Reference in New Issue
Block a user