structpb

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: BSD-3-Clause Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NullValue_name = map[int32]string{
		0: "NULL_VALUE",
	}
	NullValue_value = map[string]int32{
		"NULL_VALUE": 0,
	}
)

Enum value maps for NullValue.

View Source
var ErrJSONNotSupported = errors.New("JSON marshal/unmarshal is not supported for Struct")

ErrJSONNotSupported is returned when JSON marshaling or unmarshaling is unsupported

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

func NewList(v []interface{}) (*ListValue, error)

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) CloneMessageVT added in v0.2.1

func (m *ListValue) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*ListValue) CloneVT added in v0.2.1

func (m *ListValue) CloneVT() *ListValue

func (*ListValue) EqualMessageVT added in v0.2.1

func (this *ListValue) EqualMessageVT(thatMsg any) bool

func (*ListValue) EqualVT added in v0.2.1

func (this *ListValue) EqualVT(that *ListValue) bool

func (*ListValue) GetValues

func (x *ListValue) GetValues() []*Value

func (*ListValue) MarshalJSON added in v0.3.0

func (x *ListValue) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ListValue to JSON.

func (*ListValue) MarshalProtoJSON added in v0.3.0

func (x *ListValue) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals a ListValue to JSON.

func (*ListValue) MarshalProtoText added in v0.5.0

func (x *ListValue) MarshalProtoText() string

func (*ListValue) MarshalToSizedBufferVT added in v0.2.1

func (m *ListValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ListValue) MarshalToSizedBufferVTStrict added in v0.2.1

func (m *ListValue) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*ListValue) MarshalToVT added in v0.2.1

func (m *ListValue) MarshalToVT(dAtA []byte) (int, error)

func (*ListValue) MarshalToVTStrict added in v0.2.1

func (m *ListValue) MarshalToVTStrict(dAtA []byte) (int, error)

func (*ListValue) MarshalVT added in v0.2.1

func (m *ListValue) MarshalVT() (dAtA []byte, err error)

func (*ListValue) MarshalVTStrict added in v0.2.1

func (m *ListValue) MarshalVTStrict() (dAtA []byte, err error)

func (*ListValue) ProtoMessage

func (*ListValue) ProtoMessage()

func (*ListValue) Reset

func (x *ListValue) Reset()

func (*ListValue) SizeVT added in v0.2.1

func (m *ListValue) SizeVT() (n int)

func (*ListValue) String added in v0.5.0

func (x *ListValue) String() string

func (*ListValue) UnmarshalJSON added in v0.4.0

func (x *ListValue) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ListValue from JSON.

func (*ListValue) UnmarshalProtoJSON added in v0.4.0

func (x *ListValue) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON marshals a ListValue to JSON.

func (*ListValue) UnmarshalVT added in v0.2.1

func (m *ListValue) UnmarshalVT(dAtA []byte) error

func (*ListValue) UnmarshalVTUnsafe added in v0.2.1

func (m *ListValue) UnmarshalVTUnsafe(dAtA []byte) error

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) Enum

func (x NullValue) Enum() *NullValue

func (*NullValue) MarshalJSON added in v0.3.0

func (x *NullValue) MarshalJSON() ([]byte, error)

MarshalJSON marshals the NullValue to JSON.

func (*NullValue) MarshalProtoJSON added in v0.3.0

func (x *NullValue) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals a NullValue to JSON.

func (NullValue) MarshalProtoText added in v0.5.0

func (x NullValue) MarshalProtoText() string

func (NullValue) String added in v0.1.3

func (x NullValue) String() string

func (*NullValue) UnmarshalJSON added in v0.4.0

func (x *NullValue) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the NullValue from JSON.

func (*NullValue) UnmarshalProtoJSON added in v0.4.0

func (x *NullValue) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON marshals a NullValue to JSON.

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

func NewStruct(v map[string]interface{}) (*Struct, error)

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

func (x *Struct) AsMap() map[string]interface{}

AsMap converts x to a general-purpose Go map. The map values are converted by calling Value.AsInterface.

func (*Struct) CloneMessageVT added in v0.2.1

func (m *Struct) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Struct) CloneVT added in v0.2.1

func (m *Struct) CloneVT() *Struct

func (*Struct) EqualMessageVT added in v0.2.1

func (this *Struct) EqualMessageVT(thatMsg any) bool

func (*Struct) EqualVT added in v0.2.1

func (this *Struct) EqualVT(that *Struct) bool

func (*Struct) GetFields

func (x *Struct) GetFields() map[string]*Value

func (*Struct) MarshalJSON added in v0.3.0

func (x *Struct) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Struct to JSON.

func (*Struct) MarshalProtoJSON added in v0.3.0

func (x *Struct) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals a Struct to JSON.

func (*Struct) MarshalProtoText added in v0.5.0

func (x *Struct) MarshalProtoText() string

func (*Struct) MarshalToSizedBufferVT added in v0.2.1

func (m *Struct) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Struct) MarshalToSizedBufferVTStrict added in v0.2.1

func (m *Struct) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Struct) MarshalToVT added in v0.2.1

func (m *Struct) MarshalToVT(dAtA []byte) (int, error)

func (*Struct) MarshalToVTStrict added in v0.2.1

func (m *Struct) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Struct) MarshalVT added in v0.2.1

func (m *Struct) MarshalVT() (dAtA []byte, err error)

func (*Struct) MarshalVTStrict added in v0.2.1

func (m *Struct) MarshalVTStrict() (dAtA []byte, err error)

func (*Struct) ProtoMessage

func (*Struct) ProtoMessage()

func (*Struct) Reset

func (x *Struct) Reset()

func (*Struct) SizeVT added in v0.2.1

func (m *Struct) SizeVT() (n int)

func (*Struct) String added in v0.5.0

func (x *Struct) String() string

func (*Struct) UnmarshalJSON added in v0.4.0

func (x *Struct) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Struct from JSON.

func (*Struct) UnmarshalProtoJSON added in v0.4.0

func (x *Struct) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals a Struct from JSON.

func (*Struct) UnmarshalVT added in v0.2.1

func (m *Struct) UnmarshalVT(dAtA []byte) error

func (*Struct) UnmarshalVTUnsafe added in v0.2.1

func (m *Struct) UnmarshalVTUnsafe(dAtA []byte) error

type Struct_FieldsEntry added in v0.3.0

type Struct_FieldsEntry struct {
	Key   string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value *Value `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Struct_FieldsEntry) GetKey added in v0.3.0

func (x *Struct_FieldsEntry) GetKey() string

func (*Struct_FieldsEntry) GetValue added in v0.3.0

func (x *Struct_FieldsEntry) GetValue() *Value

func (*Struct_FieldsEntry) MarshalProtoText added in v0.5.0

func (x *Struct_FieldsEntry) MarshalProtoText() string

func (*Struct_FieldsEntry) ProtoMessage added in v0.3.0

func (*Struct_FieldsEntry) ProtoMessage()

func (*Struct_FieldsEntry) Reset added in v0.3.0

func (x *Struct_FieldsEntry) Reset()

func (*Struct_FieldsEntry) String added in v0.5.0

func (x *Struct_FieldsEntry) String() string

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 NewBoolValue

func NewBoolValue(v bool) *Value

NewBoolValue constructs a new boolean Value.

func NewListValue

func NewListValue(v *ListValue) *Value

NewListValue constructs a new list Value.

func NewNullValue

func NewNullValue() *Value

NewNullValue constructs a new null Value.

func NewNumberValue

func NewNumberValue(v float64) *Value

NewNumberValue constructs a new number Value.

func NewStringValue

func NewStringValue(v string) *Value

NewStringValue constructs a new string Value.

func NewStructValue

func NewStructValue(v *Struct) *Value

NewStructValue constructs a new struct Value.

func NewValue

func NewValue(v interface{}) (*Value, error)

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) CloneMessageVT added in v0.2.1

func (m *Value) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Value) CloneVT added in v0.2.1

func (m *Value) CloneVT() *Value

func (*Value) EqualMessageVT added in v0.2.1

func (this *Value) EqualMessageVT(thatMsg any) bool

func (*Value) EqualVT added in v0.2.1

func (this *Value) EqualVT(that *Value) bool

func (*Value) GetBoolValue

func (x *Value) GetBoolValue() bool

func (*Value) GetKind

func (m *Value) GetKind() isValue_Kind

func (*Value) GetListValue

func (x *Value) GetListValue() *ListValue

func (*Value) GetNullValue

func (x *Value) GetNullValue() NullValue

func (*Value) GetNumberValue

func (x *Value) GetNumberValue() float64

func (*Value) GetStringValue

func (x *Value) GetStringValue() string

func (*Value) GetStructValue

func (x *Value) GetStructValue() *Struct

func (*Value) MarshalJSON added in v0.3.0

func (x *Value) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Value to JSON.

func (*Value) MarshalProtoJSON added in v0.3.0

func (x *Value) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals a Value to JSON.

func (*Value) MarshalProtoText added in v0.5.0

func (x *Value) MarshalProtoText() string

func (*Value) MarshalToSizedBufferVT added in v0.2.1

func (m *Value) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Value) MarshalToSizedBufferVTStrict added in v0.2.1

func (m *Value) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Value) MarshalToVT added in v0.2.1

func (m *Value) MarshalToVT(dAtA []byte) (int, error)

func (*Value) MarshalToVTStrict added in v0.2.1

func (m *Value) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Value) MarshalVT added in v0.2.1

func (m *Value) MarshalVT() (dAtA []byte, err error)

func (*Value) MarshalVTStrict added in v0.2.1

func (m *Value) MarshalVTStrict() (dAtA []byte, err error)

func (*Value) ProtoMessage

func (*Value) ProtoMessage()

func (*Value) Reset

func (x *Value) Reset()

func (*Value) SizeVT added in v0.2.1

func (m *Value) SizeVT() (n int)

func (*Value) String added in v0.5.0

func (x *Value) String() string

func (*Value) UnmarshalJSON added in v0.4.0

func (x *Value) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Value from JSON.

func (*Value) UnmarshalProtoJSON added in v0.4.0

func (x *Value) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON marshals a Struct to JSON.

func (*Value) UnmarshalVT added in v0.2.1

func (m *Value) UnmarshalVT(dAtA []byte) error

func (*Value) UnmarshalVTUnsafe added in v0.2.1

func (m *Value) UnmarshalVTUnsafe(dAtA []byte) error

type Value_BoolValue

type Value_BoolValue struct {
	// Represents a boolean value.
	BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"`
}

func (*Value_BoolValue) CloneOneofVT added in v0.6.1

func (m *Value_BoolValue) CloneOneofVT() isValue_Kind

func (*Value_BoolValue) CloneVT added in v0.2.1

func (m *Value_BoolValue) CloneVT() *Value_BoolValue

func (*Value_BoolValue) EqualVT added in v0.2.1

func (this *Value_BoolValue) EqualVT(thatIface isValue_Kind) bool

func (*Value_BoolValue) MarshalToSizedBufferVT added in v0.2.1

func (m *Value_BoolValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Value_BoolValue) MarshalToSizedBufferVTStrict added in v0.2.1

func (m *Value_BoolValue) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Value_BoolValue) MarshalToVT added in v0.2.1

func (m *Value_BoolValue) MarshalToVT(dAtA []byte) (int, error)

func (*Value_BoolValue) MarshalToVTStrict added in v0.2.1

func (m *Value_BoolValue) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Value_BoolValue) SizeVT added in v0.2.1

func (m *Value_BoolValue) SizeVT() (n int)

type Value_ListValue

type Value_ListValue struct {
	// Represents a repeated `Value`.
	ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof"`
}

func (*Value_ListValue) CloneOneofVT added in v0.6.1

func (m *Value_ListValue) CloneOneofVT() isValue_Kind

func (*Value_ListValue) CloneVT added in v0.2.1

func (m *Value_ListValue) CloneVT() *Value_ListValue

func (*Value_ListValue) EqualVT added in v0.2.1

func (this *Value_ListValue) EqualVT(thatIface isValue_Kind) bool

func (*Value_ListValue) MarshalToSizedBufferVT added in v0.2.1

func (m *Value_ListValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Value_ListValue) MarshalToSizedBufferVTStrict added in v0.2.1

func (m *Value_ListValue) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Value_ListValue) MarshalToVT added in v0.2.1

func (m *Value_ListValue) MarshalToVT(dAtA []byte) (int, error)

func (*Value_ListValue) MarshalToVTStrict added in v0.2.1

func (m *Value_ListValue) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Value_ListValue) SizeVT added in v0.2.1

func (m *Value_ListValue) SizeVT() (n int)

type Value_NullValue

type Value_NullValue struct {
	// Represents a null value.
	NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,oneof"`
}

func (*Value_NullValue) CloneOneofVT added in v0.6.1

func (m *Value_NullValue) CloneOneofVT() isValue_Kind

func (*Value_NullValue) CloneVT added in v0.2.1

func (m *Value_NullValue) CloneVT() *Value_NullValue

func (*Value_NullValue) EqualVT added in v0.2.1

func (this *Value_NullValue) EqualVT(thatIface isValue_Kind) bool

func (*Value_NullValue) MarshalToSizedBufferVT added in v0.2.1

func (m *Value_NullValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Value_NullValue) MarshalToSizedBufferVTStrict added in v0.2.1

func (m *Value_NullValue) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Value_NullValue) MarshalToVT added in v0.2.1

func (m *Value_NullValue) MarshalToVT(dAtA []byte) (int, error)

func (*Value_NullValue) MarshalToVTStrict added in v0.2.1

func (m *Value_NullValue) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Value_NullValue) SizeVT added in v0.2.1

func (m *Value_NullValue) SizeVT() (n int)

type Value_NumberValue

type Value_NumberValue struct {
	// Represents a double value.
	NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"`
}

func (*Value_NumberValue) CloneOneofVT added in v0.6.1

func (m *Value_NumberValue) CloneOneofVT() isValue_Kind

func (*Value_NumberValue) CloneVT added in v0.2.1

func (m *Value_NumberValue) CloneVT() *Value_NumberValue

func (*Value_NumberValue) EqualVT added in v0.2.1

func (this *Value_NumberValue) EqualVT(thatIface isValue_Kind) bool

func (*Value_NumberValue) MarshalToSizedBufferVT added in v0.2.1

func (m *Value_NumberValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Value_NumberValue) MarshalToSizedBufferVTStrict added in v0.2.1

func (m *Value_NumberValue) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Value_NumberValue) MarshalToVT added in v0.2.1

func (m *Value_NumberValue) MarshalToVT(dAtA []byte) (int, error)

func (*Value_NumberValue) MarshalToVTStrict added in v0.2.1

func (m *Value_NumberValue) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Value_NumberValue) SizeVT added in v0.2.1

func (m *Value_NumberValue) SizeVT() (n int)

type Value_StringValue

type Value_StringValue struct {
	// Represents a string value.
	StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"`
}

func (*Value_StringValue) CloneOneofVT added in v0.6.1

func (m *Value_StringValue) CloneOneofVT() isValue_Kind

func (*Value_StringValue) CloneVT added in v0.2.1

func (m *Value_StringValue) CloneVT() *Value_StringValue

func (*Value_StringValue) EqualVT added in v0.2.1

func (this *Value_StringValue) EqualVT(thatIface isValue_Kind) bool

func (*Value_StringValue) MarshalToSizedBufferVT added in v0.2.1

func (m *Value_StringValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Value_StringValue) MarshalToSizedBufferVTStrict added in v0.2.1

func (m *Value_StringValue) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Value_StringValue) MarshalToVT added in v0.2.1

func (m *Value_StringValue) MarshalToVT(dAtA []byte) (int, error)

func (*Value_StringValue) MarshalToVTStrict added in v0.2.1

func (m *Value_StringValue) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Value_StringValue) SizeVT added in v0.2.1

func (m *Value_StringValue) SizeVT() (n int)

type Value_StructValue

type Value_StructValue struct {
	// Represents a structured value.
	StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"`
}

func (*Value_StructValue) CloneOneofVT added in v0.6.1

func (m *Value_StructValue) CloneOneofVT() isValue_Kind

func (*Value_StructValue) CloneVT added in v0.2.1

func (m *Value_StructValue) CloneVT() *Value_StructValue

func (*Value_StructValue) EqualVT added in v0.2.1

func (this *Value_StructValue) EqualVT(thatIface isValue_Kind) bool

func (*Value_StructValue) MarshalToSizedBufferVT added in v0.2.1

func (m *Value_StructValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Value_StructValue) MarshalToSizedBufferVTStrict added in v0.2.1

func (m *Value_StructValue) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Value_StructValue) MarshalToVT added in v0.2.1

func (m *Value_StructValue) MarshalToVT(dAtA []byte) (int, error)

func (*Value_StructValue) MarshalToVTStrict added in v0.2.1

func (m *Value_StructValue) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Value_StructValue) SizeVT added in v0.2.1

func (m *Value_StructValue) SizeVT() (n int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL