MCPcopy
hub / github.com/protocolbuffers/protobuf-go / Converter

Interface Converter

internal/impl/convert.go:21–43  ·  view source on GitHub ↗

A Converter coverts to/from Go reflect.Value types and protobuf protoreflect.Value types.

Source from the content-addressed store, hash-verified

19
20// A Converter coverts to/from Go reflect.Value types and protobuf protoreflect.Value types.
21type Converter interface {
22 // PBValueOf converts a reflect.Value to a protoreflect.Value.
23 PBValueOf(reflect.Value) protoreflect.Value
24
25 // GoValueOf converts a protoreflect.Value to a reflect.Value.
26 GoValueOf(protoreflect.Value) reflect.Value
27
28 // IsValidPB returns whether a protoreflect.Value is compatible with this type.
29 IsValidPB(protoreflect.Value) bool
30
31 // IsValidGo returns whether a reflect.Value is compatible with this type.
32 IsValidGo(reflect.Value) bool
33
34 // New returns a new field value.
35 // For scalars, it returns the default value of the field.
36 // For composite types, it returns a new mutable value.
37 New() protoreflect.Value
38
39 // Zero returns a new field value.
40 // For scalars, it returns the default value of the field.
41 // For composite types, it returns an immutable, empty value.
42 Zero() protoreflect.Value
43}
44
45// NewConverter matches a Go type with a protobuf field and returns a Converter
46// that converts between the two. Enums must be a named int32 kind that

Implementers 14

boolConverterinternal/impl/convert.go
int32Converterinternal/impl/convert.go
int64Converterinternal/impl/convert.go
uint32Converterinternal/impl/convert.go
uint64Converterinternal/impl/convert.go
float32Converterinternal/impl/convert.go
float64Converterinternal/impl/convert.go
stringConverterinternal/impl/convert.go
bytesConverterinternal/impl/convert.go
enumConverterinternal/impl/convert.go
messageConverterinternal/impl/convert.go
mapConverterinternal/impl/convert_map.go

Calls

no outgoing calls

Tested by

no test coverage detected