Documentation ¶
Index ¶
- Variables
- type ListValue
- func (x *ListValue) AsSlice() []interface{}
- func (*ListValue) Descriptor() ([]byte, []int)deprecated
- func (x *ListValue) GetValues() []*Value
- func (x *ListValue) MarshalJSON() ([]byte, error)
- func (*ListValue) ProtoMessage()
- func (x *ListValue) ProtoReflect() protoreflect.Message
- func (x *ListValue) Reset()
- func (x *ListValue) String() string
- func (x *ListValue) UnmarshalJSON(b []byte) error
- func (m *ListValue) Validate() error
- func (m *ListValue) ValidateAll() error
- type ListValueMultiError
- type ListValueValidationError
- type NullValue
- type Struct
- func (x *Struct) AsMap() map[string]interface{}
- func (*Struct) Descriptor() ([]byte, []int)deprecated
- func (x *Struct) GetFields() map[string]*Value
- func (x *Struct) MarshalJSON() ([]byte, error)
- func (*Struct) ProtoMessage()
- func (x *Struct) ProtoReflect() protoreflect.Message
- func (x *Struct) Reset()
- func (x *Struct) String() string
- func (x *Struct) UnmarshalJSON(b []byte) error
- func (m *Struct) Validate() error
- func (m *Struct) ValidateAll() error
- type StructMultiError
- type StructValidationError
- type Value
- func (x *Value) AsInterface() interface{}
- func (*Value) Descriptor() ([]byte, []int)deprecated
- func (x *Value) GetBoolValue() bool
- func (m *Value) GetKind() isValue_Kind
- func (x *Value) GetListValue() *ListValue
- func (x *Value) GetNullValue() NullValue
- func (x *Value) GetNumberValue() float64
- func (x *Value) GetStringValue() string
- func (x *Value) GetStructValue() *Struct
- func (x *Value) MarshalJSON() ([]byte, error)
- func (*Value) ProtoMessage()
- func (x *Value) ProtoReflect() protoreflect.Message
- func (x *Value) Reset()
- func (x *Value) String() string
- func (x *Value) UnmarshalJSON(b []byte) error
- func (m *Value) Validate() error
- func (m *Value) ValidateAll() error
- type ValueMultiError
- type ValueValidationError
- type Value_BoolValue
- type Value_ListValue
- type Value_NullValue
- type Value_NumberValue
- type Value_StringValue
- type Value_StructValue
Constants ¶
This section is empty.
Variables ¶
var ( NullValue_name = map[int32]string{ 0: "NULL_VALUE", } NullValue_value = map[string]int32{ "NULL_VALUE": 0, } )
Enum value maps for NullValue.
var File_struct_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type ListValue ¶
type ListValue struct { // Repeated field of dynamically typed values. Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` // contains filtered or unexported fields }
`ListValue` is a wrapper around a repeated field of values.
The JSON representation for `ListValue` is JSON array.
func NewList ¶
NewList constructs a ListValue from a general-purpose Go slice. The slice elements are converted using NewValue.
func (*ListValue) AsSlice ¶
func (x *ListValue) AsSlice() []interface{}
AsSlice converts x to a general-purpose Go slice. The slice elements are converted by calling Value.AsInterface.
func (*ListValue) Descriptor
deprecated
func (*ListValue) MarshalJSON ¶
func (*ListValue) ProtoMessage ¶
func (*ListValue) ProtoMessage()
func (*ListValue) ProtoReflect ¶
func (x *ListValue) ProtoReflect() protoreflect.Message
func (*ListValue) UnmarshalJSON ¶
func (*ListValue) Validate ¶
Validate checks the field values on ListValue with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*ListValue) ValidateAll ¶
ValidateAll checks the field values on ListValue with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ListValueMultiError, or nil if none found.
type ListValueMultiError ¶
type ListValueMultiError []error
ListValueMultiError is an error wrapping multiple validation errors returned by ListValue.ValidateAll() if the designated constraints aren't met.
func (ListValueMultiError) AllErrors ¶
func (m ListValueMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (ListValueMultiError) Error ¶
func (m ListValueMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type ListValueValidationError ¶
type ListValueValidationError struct {
// contains filtered or unexported fields
}
ListValueValidationError is the validation error returned by ListValue.Validate if the designated constraints aren't met.
func (ListValueValidationError) Cause ¶
func (e ListValueValidationError) Cause() error
Cause function returns cause value.
func (ListValueValidationError) Error ¶
func (e ListValueValidationError) Error() string
Error satisfies the builtin error interface
func (ListValueValidationError) ErrorName ¶
func (e ListValueValidationError) ErrorName() string
ErrorName returns error name.
func (ListValueValidationError) Field ¶
func (e ListValueValidationError) Field() string
Field function returns field value.
func (ListValueValidationError) Key ¶
func (e ListValueValidationError) Key() bool
Key function returns key value.
func (ListValueValidationError) Reason ¶
func (e ListValueValidationError) Reason() string
Reason function returns reason value.
type NullValue ¶
type NullValue int32
`NullValue` is a singleton enumeration to represent the null value for the `Value` type union.
The JSON representation for `NullValue` is JSON `null`.
const ( // Null value. NullValue_NULL_VALUE NullValue = 0 )
func (NullValue) Descriptor ¶
func (NullValue) Descriptor() protoreflect.EnumDescriptor
func (NullValue) EnumDescriptor
deprecated
func (NullValue) Number ¶
func (x NullValue) Number() protoreflect.EnumNumber
func (NullValue) Type ¶
func (NullValue) Type() protoreflect.EnumType
type Struct ¶
type Struct struct { // Unordered map of dynamically typed values. Fields map[string]*Value `` /* 153-byte string literal not displayed */ // contains filtered or unexported fields }
`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.
func NewStruct ¶
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 (*Struct) AsMap ¶
AsMap converts x to a general-purpose Go map. The map values are converted by calling Value.AsInterface.
func (*Struct) Descriptor
deprecated
func (*Struct) MarshalJSON ¶
func (*Struct) ProtoMessage ¶
func (*Struct) ProtoMessage()
func (*Struct) ProtoReflect ¶
func (x *Struct) ProtoReflect() protoreflect.Message
func (*Struct) UnmarshalJSON ¶
func (*Struct) Validate ¶
Validate checks the field values on Struct with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*Struct) ValidateAll ¶
ValidateAll checks the field values on Struct with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in StructMultiError, or nil if none found.
type StructMultiError ¶
type StructMultiError []error
StructMultiError is an error wrapping multiple validation errors returned by Struct.ValidateAll() if the designated constraints aren't met.
func (StructMultiError) AllErrors ¶
func (m StructMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (StructMultiError) Error ¶
func (m StructMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type StructValidationError ¶
type StructValidationError struct {
// contains filtered or unexported fields
}
StructValidationError is the validation error returned by Struct.Validate if the designated constraints aren't met.
func (StructValidationError) Cause ¶
func (e StructValidationError) Cause() error
Cause function returns cause value.
func (StructValidationError) Error ¶
func (e StructValidationError) Error() string
Error satisfies the builtin error interface
func (StructValidationError) ErrorName ¶
func (e StructValidationError) ErrorName() string
ErrorName returns error name.
func (StructValidationError) Field ¶
func (e StructValidationError) Field() string
Field function returns field value.
func (StructValidationError) Key ¶
func (e StructValidationError) Key() bool
Key function returns key value.
func (StructValidationError) Reason ¶
func (e StructValidationError) Reason() string
Reason function returns reason value.
type Value ¶
type Value struct { // The kind of value. // // Types that are assignable to Kind: // // *Value_NullValue // *Value_NumberValue // *Value_StringValue // *Value_BoolValue // *Value_StructValue // *Value_ListValue Kind isValue_Kind `protobuf_oneof:"kind"` // contains filtered or unexported fields }
`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.
func NewListValue ¶
NewListValue constructs a new list Value.
func NewNumberValue ¶
NewNumberValue constructs a new number Value.
func NewStringValue ¶
NewStringValue constructs a new string Value.
func NewStructValue ¶
NewStructValue constructs a new struct Value.
func NewValue ¶
NewValue constructs a Value from a general-purpose Go interface.
╔════════════════════════╤════════════════════════════════════════════╗ ║ Go type │ Conversion ║ ╠════════════════════════╪════════════════════════════════════════════╣ ║ nil │ stored as NullValue ║ ║ bool │ stored as BoolValue ║ ║ int, int32, int64 │ stored as NumberValue ║ ║ uint, uint32, uint64 │ stored as NumberValue ║ ║ float32, float64 │ stored as NumberValue ║ ║ string │ stored as StringValue; must be valid UTF-8 ║ ║ []byte │ stored as StringValue; base64-encoded ║ ║ map[string]interface{} │ stored as StructValue ║ ║ []interface{} │ stored as ListValue ║ ╚════════════════════════╧════════════════════════════════════════════╝
When converting an int64 or uint64 to a NumberValue, numeric precision loss is possible since they are stored as a float64.
func (*Value) AsInterface ¶
func (x *Value) AsInterface() interface{}
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 (*Value) Descriptor
deprecated
func (*Value) GetBoolValue ¶
func (*Value) GetListValue ¶
func (*Value) GetNullValue ¶
func (*Value) GetNumberValue ¶
func (*Value) GetStringValue ¶
func (*Value) GetStructValue ¶
func (*Value) MarshalJSON ¶
func (*Value) ProtoMessage ¶
func (*Value) ProtoMessage()
func (*Value) ProtoReflect ¶
func (x *Value) ProtoReflect() protoreflect.Message
func (*Value) UnmarshalJSON ¶
func (*Value) Validate ¶
Validate checks the field values on Value with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*Value) ValidateAll ¶
ValidateAll checks the field values on Value with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ValueMultiError, or nil if none found.
type ValueMultiError ¶
type ValueMultiError []error
ValueMultiError is an error wrapping multiple validation errors returned by Value.ValidateAll() if the designated constraints aren't met.
func (ValueMultiError) AllErrors ¶
func (m ValueMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (ValueMultiError) Error ¶
func (m ValueMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type ValueValidationError ¶
type ValueValidationError struct {
// contains filtered or unexported fields
}
ValueValidationError is the validation error returned by Value.Validate if the designated constraints aren't met.
func (ValueValidationError) Cause ¶
func (e ValueValidationError) Cause() error
Cause function returns cause value.
func (ValueValidationError) Error ¶
func (e ValueValidationError) Error() string
Error satisfies the builtin error interface
func (ValueValidationError) ErrorName ¶
func (e ValueValidationError) ErrorName() string
ErrorName returns error name.
func (ValueValidationError) Field ¶
func (e ValueValidationError) Field() string
Field function returns field value.
func (ValueValidationError) Key ¶
func (e ValueValidationError) Key() bool
Key function returns key value.
func (ValueValidationError) Reason ¶
func (e ValueValidationError) Reason() string
Reason function returns reason value.
type Value_BoolValue ¶
type Value_BoolValue struct { // Represents a boolean value. BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` }
type Value_ListValue ¶
type Value_ListValue struct { // Represents a repeated `Value`. ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof"` }
type Value_NullValue ¶
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 ¶
type Value_NumberValue struct { // Represents a double value. NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"` }
type Value_StringValue ¶
type Value_StringValue struct { // Represents a string value. StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` }
type Value_StructValue ¶
type Value_StructValue struct { // Represents a structured value. StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"` }