marshalField marshals the given field with protoreflect.Value.
(name string, val protoreflect.Value, fd protoreflect.FieldDescriptor)
| 200 | |
| 201 | // marshalField marshals the given field with protoreflect.Value. |
| 202 | func (e encoder) marshalField(name string, val protoreflect.Value, fd protoreflect.FieldDescriptor) error { |
| 203 | switch { |
| 204 | case fd.IsList(): |
| 205 | return e.marshalList(name, val.List(), fd) |
| 206 | case fd.IsMap(): |
| 207 | return e.marshalMap(name, val.Map(), fd) |
| 208 | default: |
| 209 | e.WriteName(name) |
| 210 | return e.marshalSingular(val, fd) |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | // marshalSingular marshals the given non-repeated field value. This includes |
| 215 | // all scalar types, enums, messages, and groups. |
no test coverage detected