type ExtensionDesc … type ExtensionRange … type Extension … type XXX_InternalExtensions … var ErrMissingExtension … var errNotExtendable … // HasExtension reports whether the extension field is present in m // either as an explicitly populated field or as an unknown field. func HasExtension(m Message, xt *ExtensionDesc) (has bool) { … } // ClearExtension removes the extension field from m // either as an explicitly populated field or as an unknown field. func ClearExtension(m Message, xt *ExtensionDesc) { … } // ClearAllExtensions clears all extensions from m. // This includes populated fields and unknown fields in the extension range. func ClearAllExtensions(m Message) { … } // GetExtension retrieves a proto2 extended field from m. // // If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), // then GetExtension parses the encoded field and returns a Go value of the specified type. // If the field is not present, then the default value is returned (if one is specified), // otherwise ErrMissingExtension is reported. // // If the descriptor is type incomplete (i.e., ExtensionDesc.ExtensionType is nil), // then GetExtension returns the raw encoded bytes for the extension field. func GetExtension(m Message, xt *ExtensionDesc) (interface{ … } type extensionResolver … func (r extensionResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { … } func (r extensionResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { … } // GetExtensions returns a list of the extensions values present in m, // corresponding with the provided list of extension descriptors, xts. // If an extension is missing in m, the corresponding value is nil. func GetExtensions(m Message, xts []*ExtensionDesc) ([]interface{ … } // SetExtension sets an extension field in m to the provided value. func SetExtension(m Message, xt *ExtensionDesc, v interface{ … } // SetRawExtension inserts b into the unknown fields of m. // // Deprecated: Use Message.ProtoReflect.SetUnknown instead. func SetRawExtension(m Message, fnum int32, b []byte) { … } // ExtensionDescs returns a list of extension descriptors found in m, // containing descriptors for both populated extension fields in m and // also unknown fields of m that are in the extension range. // For the later case, an type incomplete descriptor is provided where only // the ExtensionDesc.Field field is populated. // The order of the extension descriptors is undefined. func ExtensionDescs(m Message) ([]*ExtensionDesc, error) { … } // isValidExtension reports whether xtd is a valid extension descriptor for md. func isValidExtension(md protoreflect.MessageDescriptor, xtd protoreflect.ExtensionTypeDescriptor) bool { … } // isScalarKind reports whether k is a protobuf scalar kind (except bytes). // This function exists for historical reasons since the representation of // scalars differs between v1 and v2, where v1 uses *T and v2 uses T. func isScalarKind(k reflect.Kind) bool { … } // clearUnknown removes unknown fields from m where remover.Has reports true. func clearUnknown(m protoreflect.Message, remover interface { … } type fieldNum … func (n1 fieldNum) Has(n2 protoreflect.FieldNumber) bool { … }