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

Method Mutable

types/dynamicpb/dynamic.go:464–474  ·  view source on GitHub ↗
(k protoreflect.MapKey)

Source from the content-addressed store, hash-verified

462func (x *dynamicMap) Has(k protoreflect.MapKey) bool { return x.Get(k).IsValid() }
463func (x *dynamicMap) Clear(k protoreflect.MapKey) { delete(x.mapv, k.Interface()) }
464func (x *dynamicMap) Mutable(k protoreflect.MapKey) protoreflect.Value {
465 if x.desc.MapValue().Message() == nil {
466 panic(errors.New("%v: invalid Mutable on map with non-message value type", x.desc.FullName()))
467 }
468 v := x.Get(k)
469 if !v.IsValid() {
470 v = x.NewValue()
471 x.Set(k, v)
472 }
473 return v
474}
475func (x *dynamicMap) Len() int { return len(x.mapv) }
476func (x *dynamicMap) NewValue() protoreflect.Value {
477 if md := x.desc.MapValue().Message(); md != nil {

Callers

nothing calls this directly

Calls 8

GetMethod · 0.95
NewValueMethod · 0.95
SetMethod · 0.95
NewFunction · 0.92
MessageMethod · 0.65
MapValueMethod · 0.65
FullNameMethod · 0.65
IsValidMethod · 0.65

Tested by

no test coverage detected