var ErrMissingExtension … type ExtensionRange … type extendableProto … type extendableProtoV1 … type extensionAdapter … func (e extensionAdapter) extensionsWrite() map[int32]Extension { … } func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { … } type notLocker … func (n notLocker) Lock() { … } func (n notLocker) Unlock() { … } // extendable returns the extendableProto interface for the given generated proto message. // If the proto message has the old extension format, it returns a wrapper that implements // the extendableProto interface. func extendable(p interface{ … } var errNotExtendable … func isNilPtr(x interface{ … } type XXX_InternalExtensions … // extensionsWrite returns the extension map, creating it on first use. func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension { … } // extensionsRead returns the extensions map for read-only use. It may be nil. // The caller must hold the returned mutex's lock when accessing Elements within the map. func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) { … } type ExtensionDesc … func (ed *ExtensionDesc) repeated() bool { … } type Extension … // SetRawExtension is for testing only. func SetRawExtension(base Message, id int32, b []byte) { … } // isExtensionField returns true iff the given field number is in an extension range. func isExtensionField(pb extendableProto, field int32) bool { … } // checkExtensionTypes checks that the given extension is valid for pb. func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { … } type extPropKey … var extProp … func extensionProperties(ed *ExtensionDesc) *Properties { … } // HasExtension returns whether the given extension is present in pb. func HasExtension(pb Message, extension *ExtensionDesc) bool { … } // ClearExtension removes the given extension from pb. func ClearExtension(pb Message, extension *ExtensionDesc) { … } func clearExtension(pb Message, fieldNum int32) { … } // GetExtension retrieves a proto2 extended field from pb. // // 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 not type complete (i.e., ExtensionDesc.ExtensionType is nil), // then GetExtension returns the raw encoded bytes of the field extension. func GetExtension(pb Message, extension *ExtensionDesc) (interface{ … } // defaultExtensionValue returns the default value for extension. // If no default for an extension is defined ErrMissingExtension is returned. func defaultExtensionValue(extension *ExtensionDesc) (interface{ … } // decodeExtension decodes an extension encoded in b. func decodeExtension(b []byte, extension *ExtensionDesc) (interface{ … } // GetExtensions returns a slice of the extensions present in pb that are also listed in es. // The returned slice has the same length as es; missing extensions will appear as nil elements. func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{ … } // ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order. // For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing // just the Field field, which defines the extension's field number. func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { … } // SetExtension sets the specified extension of pb to the specified value. func SetExtension(pb Message, extension *ExtensionDesc, value interface{ … } // ClearAllExtensions clears all extensions from pb. func ClearAllExtensions(pb Message) { … } var extensionMaps … // RegisterExtension is called from the generated code. func RegisterExtension(desc *ExtensionDesc) { … } // RegisteredExtensions returns a map of the registered extensions of a // protocol buffer struct, indexed by the extension number. // The argument pb should be a nil pointer to the struct type. func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { … }