marshalMap marshals given protoreflect.Map.
(mmap protoreflect.Map, fd protoreflect.FieldDescriptor)
| 363 | |
| 364 | // marshalMap marshals given protoreflect.Map. |
| 365 | func (e encoder) marshalMap(mmap protoreflect.Map, fd protoreflect.FieldDescriptor) error { |
| 366 | e.StartObject() |
| 367 | defer e.EndObject() |
| 368 | |
| 369 | var err error |
| 370 | order.RangeEntries(mmap, order.GenericKeyOrder, func(k protoreflect.MapKey, v protoreflect.Value) bool { |
| 371 | if err = e.WriteName(k.String()); err != nil { |
| 372 | return false |
| 373 | } |
| 374 | if err = e.marshalSingular(v, fd.MapValue()); err != nil { |
| 375 | return false |
| 376 | } |
| 377 | return true |
| 378 | }) |
| 379 | return err |
| 380 | } |
no test coverage detected