Documentation
¶
Overview ¶
Package wkt -- descriptors.go builds all Well-Known Type descriptors and registers them into the global registries. The init()-based registration is in init_gc.go; TinyGo consumers should call Register() from register.go.
Package wkt implements the protobuf well-known types as defined in the google/protobuf package. It provides Go implementations of Timestamp, Duration, Any, Struct, Value, ListValue, FieldMask, Empty, NullValue, and the nine wrapper types (DoubleValue, FloatValue, Int64Value, UInt64Value, Int32Value, UInt32Value, BoolValue, StringValue, BytesValue).
All types use pre-built descriptors registered into the global type and file registries at package init time. Each message type satisfies the proto.Message interface with correct binary encoding, validation, and standard Go type conversions.
Import path: github.com/0verkilll/protobuf/wkt
Index ¶
- Variables
- func Register()
- type Any
- func (a *Any) Clone() proto.Message
- func (a *Any) Is(msg proto.Message) bool
- func (a *Any) Marshal() ([]byte, error)
- func (a *Any) MarshalAppend(b []byte) ([]byte, error)
- func (a *Any) Merge(src proto.Message) error
- func (a *Any) PackFrom(msg proto.Message) error
- func (a *Any) ProtoReflect() protoreflect.Message
- func (a *Any) Reset()
- func (a *Any) Size() int
- func (a *Any) TypeName() string
- func (a *Any) TypeURL() string
- func (a *Any) Unmarshal(b []byte) error
- func (a *Any) UnpackTo(msg proto.Message) error
- func (a *Any) Validate() error
- func (a *Any) Value() []byte
- type BoolValue
- func (w *BoolValue) Clone() proto.Message
- func (w *BoolValue) Marshal() ([]byte, error)
- func (w *BoolValue) MarshalAppend(b []byte) ([]byte, error)
- func (w *BoolValue) Merge(src proto.Message) error
- func (w *BoolValue) ProtoReflect() protoreflect.Message
- func (w *BoolValue) Reset()
- func (w *BoolValue) Size() int
- func (w *BoolValue) Unmarshal(b []byte) error
- func (w *BoolValue) Validate() error
- func (w *BoolValue) Value() bool
- type BoolValueKind
- type BytesValue
- func (w *BytesValue) Clone() proto.Message
- func (w *BytesValue) Marshal() ([]byte, error)
- func (w *BytesValue) MarshalAppend(b []byte) ([]byte, error)
- func (w *BytesValue) Merge(src proto.Message) error
- func (w *BytesValue) ProtoReflect() protoreflect.Message
- func (w *BytesValue) Reset()
- func (w *BytesValue) Size() int
- func (w *BytesValue) Unmarshal(b []byte) error
- func (w *BytesValue) Validate() error
- func (w *BytesValue) Value() []byte
- type DoubleValue
- func (w *DoubleValue) Clone() proto.Message
- func (w *DoubleValue) Marshal() ([]byte, error)
- func (w *DoubleValue) MarshalAppend(b []byte) ([]byte, error)
- func (w *DoubleValue) Merge(src proto.Message) error
- func (w *DoubleValue) ProtoReflect() protoreflect.Message
- func (w *DoubleValue) Reset()
- func (w *DoubleValue) Size() int
- func (w *DoubleValue) Unmarshal(b []byte) error
- func (w *DoubleValue) Validate() error
- func (w *DoubleValue) Value() float64
- type Duration
- func (d *Duration) AsDuration() time.Duration
- func (d *Duration) Clone() proto.Message
- func (d *Duration) Marshal() ([]byte, error)
- func (d *Duration) MarshalAppend(b []byte) ([]byte, error)
- func (d *Duration) Merge(src proto.Message) error
- func (d *Duration) Nanos() int32
- func (d *Duration) ProtoReflect() protoreflect.Message
- func (d *Duration) Reset()
- func (d *Duration) Seconds() int64
- func (d *Duration) Size() int
- func (d *Duration) Unmarshal(b []byte) error
- func (d *Duration) Validate() error
- type Empty
- func (e *Empty) Clone() proto.Message
- func (e *Empty) Marshal() ([]byte, error)
- func (e *Empty) MarshalAppend(b []byte) ([]byte, error)
- func (e *Empty) Merge(src proto.Message) error
- func (e *Empty) ProtoReflect() protoreflect.Message
- func (e *Empty) Reset()
- func (e *Empty) Size() int
- func (e *Empty) Unmarshal(b []byte) error
- func (e *Empty) Validate() error
- type FieldMask
- func (fm *FieldMask) Clone() proto.Message
- func (fm *FieldMask) Intersect(other *FieldMask) *FieldMask
- func (fm *FieldMask) IsValid(desc descriptor.MessageDescriptorAccessor) bool
- func (fm *FieldMask) Marshal() ([]byte, error)
- func (fm *FieldMask) MarshalAppend(b []byte) ([]byte, error)
- func (fm *FieldMask) Merge(src proto.Message) error
- func (fm *FieldMask) Normalize() *FieldMask
- func (fm *FieldMask) Paths() []string
- func (fm *FieldMask) ProtoReflect() protoreflect.Message
- func (fm *FieldMask) Reset()
- func (fm *FieldMask) Size() int
- func (fm *FieldMask) Union(other *FieldMask) *FieldMask
- func (fm *FieldMask) Unmarshal(b []byte) error
- func (fm *FieldMask) Validate() error
- type FloatValue
- func (w *FloatValue) Clone() proto.Message
- func (w *FloatValue) Marshal() ([]byte, error)
- func (w *FloatValue) MarshalAppend(b []byte) ([]byte, error)
- func (w *FloatValue) Merge(src proto.Message) error
- func (w *FloatValue) ProtoReflect() protoreflect.Message
- func (w *FloatValue) Reset()
- func (w *FloatValue) Size() int
- func (w *FloatValue) Unmarshal(b []byte) error
- func (w *FloatValue) Validate() error
- func (w *FloatValue) Value() float32
- type Int32Value
- func (w *Int32Value) Clone() proto.Message
- func (w *Int32Value) Marshal() ([]byte, error)
- func (w *Int32Value) MarshalAppend(b []byte) ([]byte, error)
- func (w *Int32Value) Merge(src proto.Message) error
- func (w *Int32Value) ProtoReflect() protoreflect.Message
- func (w *Int32Value) Reset()
- func (w *Int32Value) Size() int
- func (w *Int32Value) Unmarshal(b []byte) error
- func (w *Int32Value) Validate() error
- func (w *Int32Value) Value() int32
- type Int64Value
- func (w *Int64Value) Clone() proto.Message
- func (w *Int64Value) Marshal() ([]byte, error)
- func (w *Int64Value) MarshalAppend(b []byte) ([]byte, error)
- func (w *Int64Value) Merge(src proto.Message) error
- func (w *Int64Value) ProtoReflect() protoreflect.Message
- func (w *Int64Value) Reset()
- func (w *Int64Value) Size() int
- func (w *Int64Value) Unmarshal(b []byte) error
- func (w *Int64Value) Validate() error
- func (w *Int64Value) Value() int64
- type ListValue
- func (lv *ListValue) Clone() proto.Message
- func (lv *ListValue) Marshal() ([]byte, error)
- func (lv *ListValue) MarshalAppend(b []byte) ([]byte, error)
- func (lv *ListValue) Merge(src proto.Message) error
- func (lv *ListValue) ProtoReflect() protoreflect.Message
- func (lv *ListValue) Reset()
- func (lv *ListValue) Size() int
- func (lv *ListValue) Unmarshal(b []byte) error
- func (lv *ListValue) Validate() error
- func (lv *ListValue) Values() []*Value
- type ListValueKind
- type NullValue
- type NullValueKind
- type NumberValueKind
- type StringValue
- func (w *StringValue) Clone() proto.Message
- func (w *StringValue) Marshal() ([]byte, error)
- func (w *StringValue) MarshalAppend(b []byte) ([]byte, error)
- func (w *StringValue) Merge(src proto.Message) error
- func (w *StringValue) ProtoReflect() protoreflect.Message
- func (w *StringValue) Reset()
- func (w *StringValue) Size() int
- func (w *StringValue) Unmarshal(b []byte) error
- func (w *StringValue) Validate() error
- func (w *StringValue) Value() string
- type StringValueKind
- type Struct
- func (s *Struct) AsMap() map[string]any
- func (s *Struct) Clone() proto.Message
- func (s *Struct) Fields() map[string]*Value
- func (s *Struct) Marshal() ([]byte, error)
- func (s *Struct) MarshalAppend(b []byte) ([]byte, error)
- func (s *Struct) Merge(src proto.Message) error
- func (s *Struct) ProtoReflect() protoreflect.Message
- func (s *Struct) Reset()
- func (s *Struct) Size() int
- func (s *Struct) Unmarshal(b []byte) error
- func (s *Struct) Validate() error
- type StructValueKind
- type Timestamp
- func (t *Timestamp) AsTime() time.Time
- func (t *Timestamp) Clone() proto.Message
- func (t *Timestamp) Marshal() ([]byte, error)
- func (t *Timestamp) MarshalAppend(b []byte) ([]byte, error)
- func (t *Timestamp) Merge(src proto.Message) error
- func (t *Timestamp) Nanos() int32
- func (t *Timestamp) ProtoReflect() protoreflect.Message
- func (t *Timestamp) Reset()
- func (t *Timestamp) Seconds() int64
- func (t *Timestamp) Size() int
- func (t *Timestamp) Unmarshal(b []byte) error
- func (t *Timestamp) Validate() error
- type UInt32Value
- func (w *UInt32Value) Clone() proto.Message
- func (w *UInt32Value) Marshal() ([]byte, error)
- func (w *UInt32Value) MarshalAppend(b []byte) ([]byte, error)
- func (w *UInt32Value) Merge(src proto.Message) error
- func (w *UInt32Value) ProtoReflect() protoreflect.Message
- func (w *UInt32Value) Reset()
- func (w *UInt32Value) Size() int
- func (w *UInt32Value) Unmarshal(b []byte) error
- func (w *UInt32Value) Validate() error
- func (w *UInt32Value) Value() uint32
- type UInt64Value
- func (w *UInt64Value) Clone() proto.Message
- func (w *UInt64Value) Marshal() ([]byte, error)
- func (w *UInt64Value) MarshalAppend(b []byte) ([]byte, error)
- func (w *UInt64Value) Merge(src proto.Message) error
- func (w *UInt64Value) ProtoReflect() protoreflect.Message
- func (w *UInt64Value) Reset()
- func (w *UInt64Value) Size() int
- func (w *UInt64Value) Unmarshal(b []byte) error
- func (w *UInt64Value) Validate() error
- func (w *UInt64Value) Value() uint64
- type Value
- func (v *Value) Clone() proto.Message
- func (v *Value) GetBoolValue() bool
- func (v *Value) GetKind() valueKind
- func (v *Value) GetListValue() *ListValue
- func (v *Value) GetNullValue() NullValue
- func (v *Value) GetNumberValue() float64
- func (v *Value) GetStringValue() string
- func (v *Value) GetStructValue() *Struct
- func (v *Value) Marshal() ([]byte, error)
- func (v *Value) MarshalAppend(b []byte) ([]byte, error)
- func (v *Value) Merge(src proto.Message) error
- func (v *Value) ProtoReflect() protoreflect.Message
- func (v *Value) Reset()
- func (v *Value) Size() int
- func (v *Value) Unmarshal(b []byte) error
- func (v *Value) Validate() error
Constants ¶
This section is empty.
Variables ¶
var ( TimestampDescriptor descriptor.MessageDescriptorAccessor DurationDescriptor descriptor.MessageDescriptorAccessor AnyDescriptor descriptor.MessageDescriptorAccessor EmptyDescriptor descriptor.MessageDescriptorAccessor FieldMaskDescriptor descriptor.MessageDescriptorAccessor ValueDescriptor descriptor.MessageDescriptorAccessor StructDescriptor descriptor.MessageDescriptorAccessor ListValueDescriptor descriptor.MessageDescriptorAccessor DoubleValueDescriptor descriptor.MessageDescriptorAccessor FloatValueDescriptor descriptor.MessageDescriptorAccessor Int64ValueDescriptor descriptor.MessageDescriptorAccessor UInt64ValueDescriptor descriptor.MessageDescriptorAccessor Int32ValueDescriptor descriptor.MessageDescriptorAccessor UInt32ValueDescriptor descriptor.MessageDescriptorAccessor BoolValueDescriptor descriptor.MessageDescriptorAccessor StringValueDescriptor descriptor.MessageDescriptorAccessor BytesValueDescriptor descriptor.MessageDescriptorAccessor NullValueEnumDescriptor descriptor.EnumDescriptorAccessor )
Exported descriptor accessors for each WKT type. These enable downstream packages to reference WKT descriptors without registry lookups.
var EmptyInstance = &Empty{}
EmptyInstance is a package-level singleton for the Empty message. Callers that need a shared immutable Empty can reference this value instead of allocating a new one.
Functions ¶
func Register ¶
func Register()
Register builds all WKT descriptors, constructs file descriptors, registers them into the global registries, and assigns the exported descriptor accessor variables. Under standard Go this is handled by init(); under TinyGo consumers must call Register() explicitly before using WKT descriptors.
Types ¶
type Any ¶
type Any struct {
// contains filtered or unexported fields
}
Any wraps an arbitrary protobuf message along with a URL that describes the type of the serialized message. It corresponds to google.protobuf.Any.
func (*Any) Is ¶
Is reports whether the Any's typeURL matches the fully qualified name of msg's descriptor.
func (*Any) MarshalAppend ¶
MarshalAppend appends the wire-format encoding of the Any to b and returns the extended slice. Zero-value fields are omitted per proto3 semantics.
func (*Any) Merge ¶
Merge merges the fields of src into this Any. The src must be an *Any; otherwise Merge returns a type mismatch error. The typeURL is overwritten and value bytes are defensively copied.
func (*Any) PackFrom ¶
PackFrom serializes msg and stores the result in the Any, setting the typeURL to "type.googleapis.com/" followed by the message's fully qualified name obtained from its descriptor.
func (*Any) ProtoReflect ¶
func (a *Any) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access to the Any's fields via the pre-built Any descriptor.
func (*Any) Size ¶
Size returns the exact number of bytes the wire-format encoding will occupy. Zero-value fields are omitted per proto3 semantics.
func (*Any) TypeName ¶
TypeName extracts the fully qualified message name from the typeURL by returning everything after the last "/" character. It returns an empty string if the typeURL is empty or contains no "/".
func (*Any) Unmarshal ¶
Unmarshal decodes wire-format bytes into the Any. Field 1 is decoded as the typeURL string, field 2 as the value bytes.
func (*Any) UnpackTo ¶
UnpackTo deserializes the Any's value into msg. It returns an error if the typeURL does not match the message's fully qualified name.
type BoolValue ¶
type BoolValue struct {
// contains filtered or unexported fields
}
BoolValue wraps a bool value, corresponding to google.protobuf.BoolValue.
func NewBoolValue ¶
NewBoolValue creates a BoolValue wrapping v.
func (*BoolValue) MarshalAppend ¶
MarshalAppend appends the wire-format encoding of the BoolValue to b and returns the extended slice. A false value is omitted per proto3 semantics.
func (*BoolValue) Merge ¶
Merge copies the value from src into the receiver. The src must be a *BoolValue; otherwise Merge returns a type mismatch error.
func (*BoolValue) ProtoReflect ¶
func (w *BoolValue) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access.
func (*BoolValue) Size ¶
Size returns the exact number of bytes the wire-format encoding will occupy. A false value produces a zero size per proto3 semantics.
func (*BoolValue) Unmarshal ¶
Unmarshal decodes wire-format bytes into the BoolValue. Field 1 is decoded as a bool; unknown fields are skipped.
type BoolValueKind ¶
type BoolValueKind struct{ Value bool }
BoolValueKind wraps a bool for the bool_value oneof variant (field 4).
type BytesValue ¶
type BytesValue struct {
// contains filtered or unexported fields
}
BytesValue wraps a bytes ([]byte) value, corresponding to google.protobuf.BytesValue.
func NewBytesValue ¶
func NewBytesValue(v []byte) *BytesValue
NewBytesValue creates a BytesValue wrapping a defensive copy of v.
func (*BytesValue) Clone ¶
func (w *BytesValue) Clone() proto.Message
Clone returns a deep copy of the BytesValue. The value bytes are defensively copied.
func (*BytesValue) Marshal ¶
func (w *BytesValue) Marshal() ([]byte, error)
Marshal returns the wire-format encoding of the BytesValue.
func (*BytesValue) MarshalAppend ¶
func (w *BytesValue) MarshalAppend(b []byte) ([]byte, error)
MarshalAppend appends the wire-format encoding of the BytesValue to b and returns the extended slice. An empty or nil slice is omitted per proto3 semantics.
func (*BytesValue) Merge ¶
func (w *BytesValue) Merge(src proto.Message) error
Merge copies the value from src into the receiver. The src must be a *BytesValue; otherwise Merge returns a type mismatch error. The value bytes are defensively copied.
func (*BytesValue) ProtoReflect ¶
func (w *BytesValue) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access.
func (*BytesValue) Reset ¶
func (w *BytesValue) Reset()
Reset clears the BytesValue to its zero state.
func (*BytesValue) Size ¶
func (w *BytesValue) Size() int
Size returns the exact number of bytes the wire-format encoding will occupy. An empty or nil slice produces a zero size per proto3 semantics.
func (*BytesValue) Unmarshal ¶
func (w *BytesValue) Unmarshal(b []byte) error
Unmarshal decodes wire-format bytes into the BytesValue. Field 1 is decoded as a byte slice; unknown fields are skipped. The decoded bytes are defensively copied.
func (*BytesValue) Validate ¶
func (w *BytesValue) Validate() error
Validate checks structural constraints. BytesValue has no constraints beyond its type, so Validate always returns nil.
func (*BytesValue) Value ¶
func (w *BytesValue) Value() []byte
Value returns a defensive copy of the wrapped bytes.
type DoubleValue ¶
type DoubleValue struct {
// contains filtered or unexported fields
}
DoubleValue wraps a double (float64) value, corresponding to google.protobuf.DoubleValue.
func NewDoubleValue ¶
func NewDoubleValue(v float64) *DoubleValue
NewDoubleValue creates a DoubleValue wrapping v.
func (*DoubleValue) Clone ¶
func (w *DoubleValue) Clone() proto.Message
Clone returns a deep copy of the DoubleValue.
func (*DoubleValue) Marshal ¶
func (w *DoubleValue) Marshal() ([]byte, error)
Marshal returns the wire-format encoding of the DoubleValue.
func (*DoubleValue) MarshalAppend ¶
func (w *DoubleValue) MarshalAppend(b []byte) ([]byte, error)
MarshalAppend appends the wire-format encoding of the DoubleValue to b and returns the extended slice. A zero value is omitted per proto3 semantics.
func (*DoubleValue) Merge ¶
func (w *DoubleValue) Merge(src proto.Message) error
Merge copies the value from src into the receiver. The src must be a *DoubleValue; otherwise Merge returns a type mismatch error.
func (*DoubleValue) ProtoReflect ¶
func (w *DoubleValue) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access.
func (*DoubleValue) Reset ¶
func (w *DoubleValue) Reset()
Reset clears the DoubleValue to its zero state.
func (*DoubleValue) Size ¶
func (w *DoubleValue) Size() int
Size returns the exact number of bytes the wire-format encoding will occupy. A zero value produces a zero size per proto3 semantics.
func (*DoubleValue) Unmarshal ¶
func (w *DoubleValue) Unmarshal(b []byte) error
Unmarshal decodes wire-format bytes into the DoubleValue. Field 1 is decoded as a double; unknown fields are skipped.
func (*DoubleValue) Validate ¶
func (w *DoubleValue) Validate() error
Validate checks structural constraints. DoubleValue has no constraints beyond its type, so Validate always returns nil.
type Duration ¶
type Duration struct {
// contains filtered or unexported fields
}
Duration represents the google.protobuf.Duration well-known type. It holds a signed duration as seconds and nanoseconds, where nanos must have the same sign as seconds (or be zero).
func NewDuration ¶
NewDuration creates a Duration from a Go time.Duration value by decomposing it into seconds and the nanosecond remainder.
func (*Duration) AsDuration ¶
AsDuration converts the Duration to a Go time.Duration value. If the value exceeds the representable range of time.Duration, it clamps to math.MinInt64 or math.MaxInt64 nanoseconds.
func (*Duration) MarshalAppend ¶
MarshalAppend appends the wire-format encoding of the Duration to b and returns the extended slice. Zero-valued fields are omitted per proto3.
func (*Duration) Merge ¶
Merge merges the fields of src into this Duration. The src must be a *Duration. Non-zero fields from src overwrite the corresponding fields in the receiver.
func (*Duration) ProtoReflect ¶
func (d *Duration) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access to the Duration's fields via the pre-built Duration descriptor.
func (*Duration) Reset ¶
func (d *Duration) Reset()
Reset zeros both fields, returning the Duration to its initial state.
func (*Duration) Size ¶
Size returns the exact number of bytes the serialized Duration will occupy. Zero-valued fields are omitted per proto3 semantics.
type Empty ¶
type Empty struct{}
Empty represents the google.protobuf.Empty well-known type. It contains no fields and produces zero bytes when serialized.
func (*Empty) Marshal ¶
Marshal returns the serialized form of the Empty message. Because Empty has no fields, it returns nil.
func (*Empty) MarshalAppend ¶
MarshalAppend appends the serialized form of the Empty message to b and returns the unchanged slice. Because Empty has no fields, no bytes are appended.
func (*Empty) Merge ¶
Merge merges src into the receiver. The src must be an *Empty; otherwise Merge returns a type mismatch error. Because Empty has no fields, Merge is a no-op.
func (*Empty) ProtoReflect ¶
func (e *Empty) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access to the Empty message via the pre-built Empty descriptor.
func (*Empty) Reset ¶
func (e *Empty) Reset()
Reset returns the Empty message to its zero state. Because Empty has no fields, Reset is a no-op.
type FieldMask ¶
type FieldMask struct {
// contains filtered or unexported fields
}
FieldMask represents the google.protobuf.FieldMask well-known type. It contains a set of dot-separated field paths that identify which fields of a message should be read or written.
func NewFieldMask ¶
NewFieldMask creates a new FieldMask with the given paths. The input variadic slice is defensively copied.
func (*FieldMask) Intersect ¶
Intersect returns a new FieldMask containing only paths present in both this mask and other.
func (*FieldMask) IsValid ¶
func (fm *FieldMask) IsValid(desc descriptor.MessageDescriptorAccessor) bool
IsValid checks whether every path in the field mask is a valid field path for the given message descriptor. Each dot-separated segment is walked against the descriptor tree. A path is invalid if any segment does not correspond to a known field, or if a non-terminal segment refers to a non-message field.
func (*FieldMask) MarshalAppend ¶
MarshalAppend appends the wire-format encoding of the FieldMask to b and returns the extended slice. Each path is encoded as a repeated string field at field number 1.
func (*FieldMask) Merge ¶
Merge merges src into the receiver by appending src's paths. The src must be a *FieldMask; otherwise Merge returns a type mismatch error.
func (*FieldMask) Normalize ¶
Normalize returns a new FieldMask with paths deduplicated, sorted lexicographically, and with sub-paths removed. A sub-path is a path that is a strict prefix of another path when split on dots. For example, if both "a.b" and "a.b.c" are present, "a.b.c" is removed because "a.b" already covers it.
func (*FieldMask) ProtoReflect ¶
func (fm *FieldMask) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access to the FieldMask's fields via the pre-built FieldMask descriptor.
func (*FieldMask) Reset ¶
func (fm *FieldMask) Reset()
Reset clears the FieldMask to its zero state.
func (*FieldMask) Size ¶
Size returns the exact number of bytes the serialized FieldMask would occupy. Each path is encoded as a repeated string at field number 1.
func (*FieldMask) Union ¶
Union returns a new FieldMask containing the set union of paths from both this mask and other. The result is normalized.
type FloatValue ¶
type FloatValue struct {
// contains filtered or unexported fields
}
FloatValue wraps a float (float32) value, corresponding to google.protobuf.FloatValue.
func NewFloatValue ¶
func NewFloatValue(v float32) *FloatValue
NewFloatValue creates a FloatValue wrapping v.
func (*FloatValue) Clone ¶
func (w *FloatValue) Clone() proto.Message
Clone returns a deep copy of the FloatValue.
func (*FloatValue) Marshal ¶
func (w *FloatValue) Marshal() ([]byte, error)
Marshal returns the wire-format encoding of the FloatValue.
func (*FloatValue) MarshalAppend ¶
func (w *FloatValue) MarshalAppend(b []byte) ([]byte, error)
MarshalAppend appends the wire-format encoding of the FloatValue to b and returns the extended slice. A zero value is omitted per proto3 semantics.
func (*FloatValue) Merge ¶
func (w *FloatValue) Merge(src proto.Message) error
Merge copies the value from src into the receiver. The src must be a *FloatValue; otherwise Merge returns a type mismatch error.
func (*FloatValue) ProtoReflect ¶
func (w *FloatValue) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access.
func (*FloatValue) Reset ¶
func (w *FloatValue) Reset()
Reset clears the FloatValue to its zero state.
func (*FloatValue) Size ¶
func (w *FloatValue) Size() int
Size returns the exact number of bytes the wire-format encoding will occupy. A zero value produces a zero size per proto3 semantics.
func (*FloatValue) Unmarshal ¶
func (w *FloatValue) Unmarshal(b []byte) error
Unmarshal decodes wire-format bytes into the FloatValue. Field 1 is decoded as a float; unknown fields are skipped.
func (*FloatValue) Validate ¶
func (w *FloatValue) Validate() error
Validate checks structural constraints. FloatValue has no constraints beyond its type, so Validate always returns nil.
type Int32Value ¶
type Int32Value struct {
// contains filtered or unexported fields
}
Int32Value wraps an int32 value, corresponding to google.protobuf.Int32Value.
func NewInt32Value ¶
func NewInt32Value(v int32) *Int32Value
NewInt32Value creates an Int32Value wrapping v.
func (*Int32Value) Clone ¶
func (w *Int32Value) Clone() proto.Message
Clone returns a deep copy of the Int32Value.
func (*Int32Value) Marshal ¶
func (w *Int32Value) Marshal() ([]byte, error)
Marshal returns the wire-format encoding of the Int32Value.
func (*Int32Value) MarshalAppend ¶
func (w *Int32Value) MarshalAppend(b []byte) ([]byte, error)
MarshalAppend appends the wire-format encoding of the Int32Value to b and returns the extended slice. A zero value is omitted per proto3 semantics.
func (*Int32Value) Merge ¶
func (w *Int32Value) Merge(src proto.Message) error
Merge copies the value from src into the receiver. The src must be a *Int32Value; otherwise Merge returns a type mismatch error.
func (*Int32Value) ProtoReflect ¶
func (w *Int32Value) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access.
func (*Int32Value) Reset ¶
func (w *Int32Value) Reset()
Reset clears the Int32Value to its zero state.
func (*Int32Value) Size ¶
func (w *Int32Value) Size() int
Size returns the exact number of bytes the wire-format encoding will occupy. A zero value produces a zero size per proto3 semantics.
func (*Int32Value) Unmarshal ¶
func (w *Int32Value) Unmarshal(b []byte) error
Unmarshal decodes wire-format bytes into the Int32Value. Field 1 is decoded as an int32; unknown fields are skipped.
func (*Int32Value) Validate ¶
func (w *Int32Value) Validate() error
Validate checks structural constraints. Int32Value has no constraints beyond its type, so Validate always returns nil.
type Int64Value ¶
type Int64Value struct {
// contains filtered or unexported fields
}
Int64Value wraps an int64 value, corresponding to google.protobuf.Int64Value.
func NewInt64Value ¶
func NewInt64Value(v int64) *Int64Value
NewInt64Value creates an Int64Value wrapping v.
func (*Int64Value) Clone ¶
func (w *Int64Value) Clone() proto.Message
Clone returns a deep copy of the Int64Value.
func (*Int64Value) Marshal ¶
func (w *Int64Value) Marshal() ([]byte, error)
Marshal returns the wire-format encoding of the Int64Value.
func (*Int64Value) MarshalAppend ¶
func (w *Int64Value) MarshalAppend(b []byte) ([]byte, error)
MarshalAppend appends the wire-format encoding of the Int64Value to b and returns the extended slice. A zero value is omitted per proto3 semantics.
func (*Int64Value) Merge ¶
func (w *Int64Value) Merge(src proto.Message) error
Merge copies the value from src into the receiver. The src must be a *Int64Value; otherwise Merge returns a type mismatch error.
func (*Int64Value) ProtoReflect ¶
func (w *Int64Value) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access.
func (*Int64Value) Reset ¶
func (w *Int64Value) Reset()
Reset clears the Int64Value to its zero state.
func (*Int64Value) Size ¶
func (w *Int64Value) Size() int
Size returns the exact number of bytes the wire-format encoding will occupy. A zero value produces a zero size per proto3 semantics.
func (*Int64Value) Unmarshal ¶
func (w *Int64Value) Unmarshal(b []byte) error
Unmarshal decodes wire-format bytes into the Int64Value. Field 1 is decoded as an int64; unknown fields are skipped.
func (*Int64Value) Validate ¶
func (w *Int64Value) Validate() error
Validate checks structural constraints. Int64Value has no constraints beyond its type, so Validate always returns nil.
type ListValue ¶
type ListValue struct {
// contains filtered or unexported fields
}
ListValue represents the google.protobuf.ListValue well-known type. It holds an ordered list of dynamically typed Value elements, analogous to a JSON array.
func NewListValue ¶
NewListValue creates a ListValue with a defensive copy of the given values slice.
func (*ListValue) MarshalAppend ¶
MarshalAppend appends the wire-format encoding of the ListValue to b and returns the extended slice. Each value is encoded as a repeated message field at field number 1.
func (*ListValue) Merge ¶
Merge merges src into the receiver by appending deep copies of src's values. The src must be a *ListValue.
func (*ListValue) ProtoReflect ¶
func (lv *ListValue) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access to the ListValue's fields via the pre-built ListValue descriptor.
func (*ListValue) Reset ¶
func (lv *ListValue) Reset()
Reset clears the ListValue to its zero state.
func (*ListValue) Size ¶
Size returns the exact number of bytes the serialized ListValue will occupy. Each value is encoded as a repeated message at field number 1.
func (*ListValue) Unmarshal ¶
Unmarshal decodes wire-format bytes into the ListValue. Each field 1 entry is decoded as a Value message and appended to the values slice.
type ListValueKind ¶
type ListValueKind struct{ Value *ListValue }
ListValueKind wraps a *ListValue for the list_value oneof variant (field 6).
type NullValue ¶
type NullValue int32
NullValue represents the google.protobuf.NullValue enum, which is used to represent a JSON null in the protobuf type system. It has a single defined value of 0 (NULL_VALUE).
const NullValue_NULL_VALUE NullValue = 0
NullValue_NULL_VALUE is the sole defined value of the NullValue enum, representing JSON null.
type NullValueKind ¶
type NullValueKind struct{ Value NullValue }
NullValueKind wraps a NullValue for the null_value oneof variant (field 1).
type NumberValueKind ¶
type NumberValueKind struct{ Value float64 }
NumberValueKind wraps a float64 for the number_value oneof variant (field 2).
type StringValue ¶
type StringValue struct {
// contains filtered or unexported fields
}
StringValue wraps a string value, corresponding to google.protobuf.StringValue.
func NewStringValue ¶
func NewStringValue(v string) *StringValue
NewStringValue creates a StringValue wrapping v.
func (*StringValue) Clone ¶
func (w *StringValue) Clone() proto.Message
Clone returns a deep copy of the StringValue.
func (*StringValue) Marshal ¶
func (w *StringValue) Marshal() ([]byte, error)
Marshal returns the wire-format encoding of the StringValue.
func (*StringValue) MarshalAppend ¶
func (w *StringValue) MarshalAppend(b []byte) ([]byte, error)
MarshalAppend appends the wire-format encoding of the StringValue to b and returns the extended slice. An empty string is omitted per proto3 semantics.
func (*StringValue) Merge ¶
func (w *StringValue) Merge(src proto.Message) error
Merge copies the value from src into the receiver. The src must be a *StringValue; otherwise Merge returns a type mismatch error.
func (*StringValue) ProtoReflect ¶
func (w *StringValue) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access.
func (*StringValue) Reset ¶
func (w *StringValue) Reset()
Reset clears the StringValue to its zero state.
func (*StringValue) Size ¶
func (w *StringValue) Size() int
Size returns the exact number of bytes the wire-format encoding will occupy. An empty string produces a zero size per proto3 semantics.
func (*StringValue) Unmarshal ¶
func (w *StringValue) Unmarshal(b []byte) error
Unmarshal decodes wire-format bytes into the StringValue. Field 1 is decoded as a string; unknown fields are skipped.
func (*StringValue) Validate ¶
func (w *StringValue) Validate() error
Validate checks structural constraints. StringValue has no constraints beyond its type, so Validate always returns nil.
type StringValueKind ¶
type StringValueKind struct{ Value string }
StringValueKind wraps a string for the string_value oneof variant (field 3).
type Struct ¶
type Struct struct {
// contains filtered or unexported fields
}
Struct represents the google.protobuf.Struct well-known type. It holds a set of named fields, each containing a dynamically typed Value, analogous to a JSON object.
func NewStructFromMap ¶
NewStructFromMap creates a Struct from a map[string]any by converting each value to a *Value using anyToValue. Supported value types are nil, bool, float64, int, int64, string, []any, and map[string]any. Unsupported types produce an error. This method is the marshal-direction counterpart to AsMap.
func (*Struct) AsMap ¶
AsMap converts the Struct to a map[string]any by recursively converting each *Value to its Go native equivalent. This is the unmarshal-direction counterpart to NewStructFromMap.
func (*Struct) MarshalAppend ¶
MarshalAppend appends the wire-format encoding of the Struct to b and returns the extended slice. Each map entry is encoded as a length-delimited sub-message at outer field 1, containing the key at inner field 1 (string) and the value at inner field 2 (message).
func (*Struct) Merge ¶
Merge merges src into the receiver. The src must be a *Struct. For each key in src, if the receiver already has that key the values are merged recursively; otherwise the entry is inserted as a deep copy.
func (*Struct) ProtoReflect ¶
func (s *Struct) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access to the Struct's fields via the pre-built Struct descriptor.
func (*Struct) Size ¶
Size returns the exact number of bytes the serialized Struct will occupy. Each map entry is encoded as a length-delimited sub-message at field 1.
type StructValueKind ¶
type StructValueKind struct{ Value *Struct }
StructValueKind wraps a *Struct for the struct_value oneof variant (field 5).
type Timestamp ¶
type Timestamp struct {
// contains filtered or unexported fields
}
Timestamp represents the google.protobuf.Timestamp well-known type. It holds a point in time as seconds and nanoseconds since the Unix epoch (1970-01-01 UTC).
func NewTimestamp ¶
NewTimestamp creates a Timestamp from a Go time.Time value by extracting the Unix seconds and nanosecond remainder.
func (*Timestamp) MarshalAppend ¶
MarshalAppend appends the wire-format encoding of the Timestamp to b and returns the extended slice. Zero-valued fields are omitted per proto3.
func (*Timestamp) Merge ¶
Merge merges the fields of src into this Timestamp. The src must be a *Timestamp. Non-zero fields from src overwrite the corresponding fields in the receiver.
func (*Timestamp) ProtoReflect ¶
func (t *Timestamp) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access to the Timestamp's fields via the pre-built Timestamp descriptor.
func (*Timestamp) Reset ¶
func (t *Timestamp) Reset()
Reset zeros both fields, returning the Timestamp to its initial state.
func (*Timestamp) Size ¶
Size returns the exact number of bytes the serialized Timestamp will occupy. Zero-valued fields are omitted per proto3 semantics.
type UInt32Value ¶
type UInt32Value struct {
// contains filtered or unexported fields
}
UInt32Value wraps a uint32 value, corresponding to google.protobuf.UInt32Value.
func NewUInt32Value ¶
func NewUInt32Value(v uint32) *UInt32Value
NewUInt32Value creates a UInt32Value wrapping v.
func (*UInt32Value) Clone ¶
func (w *UInt32Value) Clone() proto.Message
Clone returns a deep copy of the UInt32Value.
func (*UInt32Value) Marshal ¶
func (w *UInt32Value) Marshal() ([]byte, error)
Marshal returns the wire-format encoding of the UInt32Value.
func (*UInt32Value) MarshalAppend ¶
func (w *UInt32Value) MarshalAppend(b []byte) ([]byte, error)
MarshalAppend appends the wire-format encoding of the UInt32Value to b and returns the extended slice. A zero value is omitted per proto3 semantics.
func (*UInt32Value) Merge ¶
func (w *UInt32Value) Merge(src proto.Message) error
Merge copies the value from src into the receiver. The src must be a *UInt32Value; otherwise Merge returns a type mismatch error.
func (*UInt32Value) ProtoReflect ¶
func (w *UInt32Value) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access.
func (*UInt32Value) Reset ¶
func (w *UInt32Value) Reset()
Reset clears the UInt32Value to its zero state.
func (*UInt32Value) Size ¶
func (w *UInt32Value) Size() int
Size returns the exact number of bytes the wire-format encoding will occupy. A zero value produces a zero size per proto3 semantics.
func (*UInt32Value) Unmarshal ¶
func (w *UInt32Value) Unmarshal(b []byte) error
Unmarshal decodes wire-format bytes into the UInt32Value. Field 1 is decoded as a uint32; unknown fields are skipped.
func (*UInt32Value) Validate ¶
func (w *UInt32Value) Validate() error
Validate checks structural constraints. UInt32Value has no constraints beyond its type, so Validate always returns nil.
type UInt64Value ¶
type UInt64Value struct {
// contains filtered or unexported fields
}
UInt64Value wraps a uint64 value, corresponding to google.protobuf.UInt64Value.
func NewUInt64Value ¶
func NewUInt64Value(v uint64) *UInt64Value
NewUInt64Value creates a UInt64Value wrapping v.
func (*UInt64Value) Clone ¶
func (w *UInt64Value) Clone() proto.Message
Clone returns a deep copy of the UInt64Value.
func (*UInt64Value) Marshal ¶
func (w *UInt64Value) Marshal() ([]byte, error)
Marshal returns the wire-format encoding of the UInt64Value.
func (*UInt64Value) MarshalAppend ¶
func (w *UInt64Value) MarshalAppend(b []byte) ([]byte, error)
MarshalAppend appends the wire-format encoding of the UInt64Value to b and returns the extended slice. A zero value is omitted per proto3 semantics.
func (*UInt64Value) Merge ¶
func (w *UInt64Value) Merge(src proto.Message) error
Merge copies the value from src into the receiver. The src must be a *UInt64Value; otherwise Merge returns a type mismatch error.
func (*UInt64Value) ProtoReflect ¶
func (w *UInt64Value) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access.
func (*UInt64Value) Reset ¶
func (w *UInt64Value) Reset()
Reset clears the UInt64Value to its zero state.
func (*UInt64Value) Size ¶
func (w *UInt64Value) Size() int
Size returns the exact number of bytes the wire-format encoding will occupy. A zero value produces a zero size per proto3 semantics.
func (*UInt64Value) Unmarshal ¶
func (w *UInt64Value) Unmarshal(b []byte) error
Unmarshal decodes wire-format bytes into the UInt64Value. Field 1 is decoded as a uint64; unknown fields are skipped.
func (*UInt64Value) Validate ¶
func (w *UInt64Value) Validate() error
Validate checks structural constraints. UInt64Value has no constraints beyond its type, so Validate always returns nil.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value represents the google.protobuf.Value well-known type. It holds a dynamically typed value via a sealed oneof interface with six variants: null, number, string, bool, struct, and list.
func ValueOfBool ¶
ValueOfBool creates a Value with the bool_value variant.
func ValueOfList ¶
ValueOfList creates a Value with the list_value variant.
func ValueOfNull ¶
func ValueOfNull() *Value
ValueOfNull creates a Value with the null_value variant.
func ValueOfNumber ¶
ValueOfNumber creates a Value with the number_value variant.
func ValueOfString ¶
ValueOfString creates a Value with the string_value variant.
func ValueOfStruct ¶
ValueOfStruct creates a Value with the struct_value variant.
func (*Value) GetBoolValue ¶
GetBoolValue returns the bool if the active variant is BoolValueKind, or false otherwise.
func (*Value) GetKind ¶
func (v *Value) GetKind() valueKind
GetKind returns the active oneof variant, or nil if no variant is set.
func (*Value) GetListValue ¶
GetListValue returns the list if the active variant is ListValueKind, or nil otherwise.
func (*Value) GetNullValue ¶
GetNullValue returns the null value if the active variant is NullValueKind, or the zero NullValue otherwise.
func (*Value) GetNumberValue ¶
GetNumberValue returns the number if the active variant is NumberValueKind, or 0 otherwise.
func (*Value) GetStringValue ¶
GetStringValue returns the string if the active variant is StringValueKind, or "" otherwise.
func (*Value) GetStructValue ¶
GetStructValue returns the struct if the active variant is StructValueKind, or nil otherwise.
func (*Value) MarshalAppend ¶
MarshalAppend appends the wire-format encoding of the Value to b and returns the extended slice. Only the active oneof field is encoded.
func (*Value) Merge ¶
Merge merges the fields of src into this Value. The src must be a *Value. The kind from src overwrites the kind in the receiver, with deep copies for struct and list variants.
func (*Value) ProtoReflect ¶
func (v *Value) ProtoReflect() protoreflect.Message
ProtoReflect returns a protoreflect.Message providing dynamic field access to the Value's oneof fields via the pre-built Value descriptor.