filedesc

package
v1.35.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2024 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package filedesc provides functionality for constructing descriptors.

The types in this package implement interfaces in the protoreflect package related to protobuf descripriptors.

Index

Constants

This section is empty.

Variables

View Source
var (
	SurrogateProto2      = &File{L1: FileL1{Syntax: protoreflect.Proto2}, L2: &FileL2{}}
	SurrogateProto3      = &File{L1: FileL1{Syntax: protoreflect.Proto3}, L2: &FileL2{}}
	SurrogateEdition2023 = &File{L1: FileL1{Syntax: protoreflect.Editions, Edition: Edition2023}, L2: &FileL2{}}
)

Surrogate files are can be used to create standalone descriptors where the syntax is only information derived from the parent file.

Functions

func DefaultValue

func DefaultValue(v protoreflect.Value, ev protoreflect.EnumValueDescriptor) defaultValue

Types

type Base

type Base struct {
	L0 BaseL0
}

func (*Base) FullName

func (d *Base) FullName() protoreflect.FullName

func (*Base) Index

func (d *Base) Index() int

func (*Base) IsPlaceholder

func (d *Base) IsPlaceholder() bool

func (*Base) Name

func (d *Base) Name() protoreflect.Name

func (*Base) Parent

func (d *Base) Parent() protoreflect.Descriptor

func (*Base) ParentFile

func (d *Base) ParentFile() protoreflect.FileDescriptor

func (*Base) ProtoInternal

func (d *Base) ProtoInternal(pragma.DoNotImplement)

func (*Base) Syntax

func (d *Base) Syntax() protoreflect.Syntax

type BaseL0

type BaseL0 struct {
	FullName   protoreflect.FullName // must be populated
	ParentFile *File                 // must be populated
	Parent     protoreflect.Descriptor
	Index      int
}

type Builder

type Builder struct {
	// GoPackagePath is the Go package path that is invoking this builder.
	GoPackagePath string

	// RawDescriptor is the wire-encoded bytes of FileDescriptorProto
	// and must be populated.
	RawDescriptor []byte

	// NumEnums is the total number of enums declared in the file.
	NumEnums int32
	// NumMessages is the total number of messages declared in the file.
	// It includes the implicit message declarations for map entries.
	NumMessages int32
	// NumExtensions is the total number of extensions declared in the file.
	NumExtensions int32
	// NumServices is the total number of services declared in the file.
	NumServices int32

	// TypeResolver resolves extension field types for descriptor options.
	// If nil, it uses protoregistry.GlobalTypes.
	TypeResolver interface {
		protoregistry.ExtensionTypeResolver
	}

	// FileRegistry is use to lookup file, enum, and message dependencies.
	// Once constructed, the file descriptor is registered here.
	// If nil, it uses protoregistry.GlobalFiles.
	FileRegistry interface {
		FindFileByPath(string) (protoreflect.FileDescriptor, error)
		FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)
		RegisterFile(protoreflect.FileDescriptor) error
	}
}

Builder construct a protoreflect.FileDescriptor from the raw descriptor.

func (Builder) Build

func (db Builder) Build() (out Out)

Build constructs a FileDescriptor given the parameters set in Builder. It assumes that the inputs are well-formed and panics if any inconsistencies are encountered.

If NumEnums+NumMessages+NumExtensions+NumServices is zero, then Build automatically derives them from the raw descriptor.

type Edition added in v1.32.0

type Edition int32

Edition is an Enum for proto2.Edition

const (
	EditionUnknown     Edition = 0
	EditionProto2      Edition = 998
	EditionProto3      Edition = 999
	Edition2023        Edition = 1000
	Edition2024        Edition = 1001
	EditionUnsupported Edition = 100000
)

These values align with the value of Enum in descriptor.proto which allows direct conversion between the proto enum and this enum.

type EditionFeatures added in v1.33.0

type EditionFeatures struct {
	// StripEnumPrefix determines if the plugin generates enum value
	// constants as-is, with their prefix stripped, or both variants.
	StripEnumPrefix int

	// IsFieldPresence is true if field_presence is EXPLICIT
	// https://protobuf.dev/editions/features/#field_presence
	IsFieldPresence bool

	// IsFieldPresence is true if field_presence is LEGACY_REQUIRED
	// https://protobuf.dev/editions/features/#field_presence
	IsLegacyRequired bool

	// IsOpenEnum is true if enum_type is OPEN
	// https://protobuf.dev/editions/features/#enum_type
	IsOpenEnum bool

	// IsPacked is true if repeated_field_encoding is PACKED
	// https://protobuf.dev/editions/features/#repeated_field_encoding
	IsPacked bool

	// IsUTF8Validated is true if utf_validation is VERIFY
	// https://protobuf.dev/editions/features/#utf8_validation
	IsUTF8Validated bool

	// IsDelimitedEncoded is true if message_encoding is DELIMITED
	// https://protobuf.dev/editions/features/#message_encoding
	IsDelimitedEncoded bool

	// IsJSONCompliant is true if json_format is ALLOW
	// https://protobuf.dev/editions/features/#json_format
	IsJSONCompliant bool

	// GenerateLegacyUnmarshalJSON determines if the plugin generates the
	// UnmarshalJSON([]byte) error method for enums.
	GenerateLegacyUnmarshalJSON bool
}

EditionFeatures is a frequently-instantiated struct, so please take care to minimize padding when adding new fields to this struct (add them in the right place/order).

type Enum

type Enum struct {
	Base
	L1 EnumL1
	L2 *EnumL2 // protected by fileDesc.once
}

func (*Enum) Format

func (ed *Enum) Format(s fmt.State, r rune)

func (*Enum) IsClosed added in v1.34.0

func (ed *Enum) IsClosed() bool

func (*Enum) Options

func (ed *Enum) Options() protoreflect.ProtoMessage

func (*Enum) ProtoType

func (ed *Enum) ProtoType(protoreflect.EnumDescriptor)

func (*Enum) ReservedNames

func (ed *Enum) ReservedNames() protoreflect.Names

func (*Enum) ReservedRanges

func (ed *Enum) ReservedRanges() protoreflect.EnumRanges

func (*Enum) Values

func (ed *Enum) Values() protoreflect.EnumValueDescriptors

type EnumL1

type EnumL1 struct {
	EditionFeatures EditionFeatures
	// contains filtered or unexported fields
}

type EnumL2

type EnumL2 struct {
	Options        func() protoreflect.ProtoMessage
	Values         EnumValues
	ReservedNames  Names
	ReservedRanges EnumRanges
}

type EnumRanges

type EnumRanges struct {
	List [][2]protoreflect.EnumNumber // start inclusive; end inclusive
	// contains filtered or unexported fields
}

func (*EnumRanges) CheckValid

func (p *EnumRanges) CheckValid() error

CheckValid reports any errors with the set of names with an error message that completes the sentence: "ranges is invalid because it has ..."

func (*EnumRanges) Format

func (p *EnumRanges) Format(s fmt.State, r rune)

func (*EnumRanges) Get

func (p *EnumRanges) Get(i int) [2]protoreflect.EnumNumber

func (*EnumRanges) Has

func (*EnumRanges) Len

func (p *EnumRanges) Len() int

func (*EnumRanges) ProtoInternal

func (p *EnumRanges) ProtoInternal(pragma.DoNotImplement)

type EnumValue

type EnumValue struct {
	Base
	L1 EnumValueL1
}

func (*EnumValue) Format

func (ed *EnumValue) Format(s fmt.State, r rune)

func (*EnumValue) Number

func (ed *EnumValue) Number() protoreflect.EnumNumber

func (*EnumValue) Options

func (ed *EnumValue) Options() protoreflect.ProtoMessage

func (*EnumValue) ProtoType

type EnumValueL1

type EnumValueL1 struct {
	Options func() protoreflect.ProtoMessage
	Number  protoreflect.EnumNumber
}

type EnumValues

type EnumValues struct {
	List []EnumValue
	// contains filtered or unexported fields
}

func (*EnumValues) ByName

func (*EnumValues) ByNumber

func (*EnumValues) Format

func (p *EnumValues) Format(s fmt.State, r rune)

func (*EnumValues) Get

func (*EnumValues) Len

func (p *EnumValues) Len() int

func (*EnumValues) ProtoInternal

func (p *EnumValues) ProtoInternal(pragma.DoNotImplement)

type Enums

type Enums struct {
	List []Enum
	// contains filtered or unexported fields
}

func (*Enums) ByName

func (*Enums) Format

func (p *Enums) Format(s fmt.State, r rune)

func (*Enums) Get

func (*Enums) Len

func (p *Enums) Len() int

func (*Enums) ProtoInternal

func (p *Enums) ProtoInternal(pragma.DoNotImplement)

type Extension

type Extension struct {
	Base
	L1 ExtensionL1
	L2 *ExtensionL2 // protected by fileDesc.once
}

func (*Extension) Cardinality

func (xd *Extension) Cardinality() protoreflect.Cardinality

func (*Extension) ContainingMessage

func (xd *Extension) ContainingMessage() protoreflect.MessageDescriptor

func (*Extension) ContainingOneof

func (xd *Extension) ContainingOneof() protoreflect.OneofDescriptor

func (*Extension) Default

func (xd *Extension) Default() protoreflect.Value

func (*Extension) DefaultEnumValue

func (xd *Extension) DefaultEnumValue() protoreflect.EnumValueDescriptor

func (*Extension) Enum

func (*Extension) Format

func (xd *Extension) Format(s fmt.State, r rune)

func (*Extension) HasDefault

func (xd *Extension) HasDefault() bool

func (*Extension) HasJSONName

func (xd *Extension) HasJSONName() bool

func (*Extension) HasOptionalKeyword added in v1.22.0

func (xd *Extension) HasOptionalKeyword() bool

func (*Extension) HasPresence added in v1.22.0

func (xd *Extension) HasPresence() bool

func (*Extension) IsExtension

func (xd *Extension) IsExtension() bool

func (*Extension) IsLazy added in v1.35.0

func (xd *Extension) IsLazy() bool

func (*Extension) IsList

func (xd *Extension) IsList() bool

func (*Extension) IsMap

func (xd *Extension) IsMap() bool

func (*Extension) IsPacked

func (xd *Extension) IsPacked() bool

func (*Extension) IsWeak

func (xd *Extension) IsWeak() bool

func (*Extension) JSONName

func (xd *Extension) JSONName() string

func (*Extension) Kind

func (xd *Extension) Kind() protoreflect.Kind

func (*Extension) MapKey

func (xd *Extension) MapKey() protoreflect.FieldDescriptor

func (*Extension) MapValue

func (xd *Extension) MapValue() protoreflect.FieldDescriptor

func (*Extension) Message

func (*Extension) Number

func (xd *Extension) Number() protoreflect.FieldNumber

func (*Extension) Options

func (xd *Extension) Options() protoreflect.ProtoMessage

func (*Extension) ProtoInternal

func (xd *Extension) ProtoInternal(pragma.DoNotImplement)

func (*Extension) ProtoType

func (xd *Extension) ProtoType(protoreflect.FieldDescriptor)

func (*Extension) TextName added in v1.26.0

func (xd *Extension) TextName() string

type ExtensionL1

type ExtensionL1 struct {
	Number          protoreflect.FieldNumber
	Extendee        protoreflect.MessageDescriptor
	Cardinality     protoreflect.Cardinality
	Kind            protoreflect.Kind
	IsLazy          bool
	EditionFeatures EditionFeatures
}

type ExtensionL2

type ExtensionL2 struct {
	Options          func() protoreflect.ProtoMessage
	StringName       stringName
	IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
	Default          defaultValue
	Enum             protoreflect.EnumDescriptor
	Message          protoreflect.MessageDescriptor
}

type Extensions

type Extensions struct {
	List []Extension
	// contains filtered or unexported fields
}

func (*Extensions) ByName

func (*Extensions) Format

func (p *Extensions) Format(s fmt.State, r rune)

func (*Extensions) Get

func (*Extensions) Len

func (p *Extensions) Len() int

func (*Extensions) ProtoInternal

func (p *Extensions) ProtoInternal(pragma.DoNotImplement)

type Field

type Field struct {
	Base
	L1 FieldL1
}

func (*Field) Cardinality

func (fd *Field) Cardinality() protoreflect.Cardinality

func (*Field) ContainingMessage

func (fd *Field) ContainingMessage() protoreflect.MessageDescriptor

func (*Field) ContainingOneof

func (fd *Field) ContainingOneof() protoreflect.OneofDescriptor

func (*Field) Default

func (fd *Field) Default() protoreflect.Value

func (*Field) DefaultEnumValue

func (fd *Field) DefaultEnumValue() protoreflect.EnumValueDescriptor

func (*Field) EnforceUTF8

func (fd *Field) EnforceUTF8() bool

EnforceUTF8 is a pseudo-internal API to determine whether to enforce UTF-8 validation for the string field. This exists for Google-internal use only since proto3 did not enforce UTF-8 validity prior to the open-source release. If this method does not exist, the default is to enforce valid UTF-8.

WARNING: This method is exempt from the compatibility promise and may be removed in the future without warning.

func (*Field) Enum

func (fd *Field) Enum() protoreflect.EnumDescriptor

func (*Field) Format

func (fd *Field) Format(s fmt.State, r rune)

func (*Field) HasDefault

func (fd *Field) HasDefault() bool

func (*Field) HasJSONName

func (fd *Field) HasJSONName() bool

func (*Field) HasOptionalKeyword added in v1.22.0

func (fd *Field) HasOptionalKeyword() bool

func (*Field) HasPresence added in v1.22.0

func (fd *Field) HasPresence() bool

func (*Field) IsExtension

func (fd *Field) IsExtension() bool

func (*Field) IsLazy added in v1.35.0

func (fd *Field) IsLazy() bool

func (*Field) IsList

func (fd *Field) IsList() bool

func (*Field) IsMap

func (fd *Field) IsMap() bool

func (*Field) IsMapEntry added in v1.34.2

func (fd *Field) IsMapEntry() bool

func (*Field) IsPacked

func (fd *Field) IsPacked() bool

func (*Field) IsWeak

func (fd *Field) IsWeak() bool

func (*Field) JSONName

func (fd *Field) JSONName() string

func (*Field) Kind

func (fd *Field) Kind() protoreflect.Kind

func (*Field) MapKey

func (fd *Field) MapKey() protoreflect.FieldDescriptor

func (*Field) MapValue

func (fd *Field) MapValue() protoreflect.FieldDescriptor

func (*Field) Message

func (fd *Field) Message() protoreflect.MessageDescriptor

func (*Field) Number

func (fd *Field) Number() protoreflect.FieldNumber

func (*Field) Options

func (fd *Field) Options() protoreflect.ProtoMessage

func (*Field) ProtoType

func (fd *Field) ProtoType(protoreflect.FieldDescriptor)

func (*Field) TextName added in v1.26.0

func (fd *Field) TextName() string

type FieldL1

type FieldL1 struct {
	Options          func() protoreflect.ProtoMessage
	Number           protoreflect.FieldNumber
	Cardinality      protoreflect.Cardinality // must be consistent with Message.RequiredNumbers
	Kind             protoreflect.Kind
	StringName       stringName
	IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
	IsWeak           bool // promoted from google.protobuf.FieldOptions
	IsLazy           bool // promoted from google.protobuf.FieldOptions
	Default          defaultValue
	ContainingOneof  protoreflect.OneofDescriptor // must be consistent with Message.Oneofs.Fields
	Enum             protoreflect.EnumDescriptor
	Message          protoreflect.MessageDescriptor

	EditionFeatures EditionFeatures
}

type FieldNumbers

type FieldNumbers struct {
	List []protoreflect.FieldNumber
	// contains filtered or unexported fields
}

func (*FieldNumbers) Format

func (p *FieldNumbers) Format(s fmt.State, r rune)

func (*FieldNumbers) Get

func (*FieldNumbers) Has

func (*FieldNumbers) Len

func (p *FieldNumbers) Len() int

func (*FieldNumbers) ProtoInternal

func (p *FieldNumbers) ProtoInternal(pragma.DoNotImplement)

type FieldRanges

type FieldRanges struct {
	List [][2]protoreflect.FieldNumber // start inclusive; end exclusive
	// contains filtered or unexported fields
}

func (*FieldRanges) CheckOverlap

func (p *FieldRanges) CheckOverlap(q *FieldRanges) error

CheckOverlap reports an error if p and q overlap.

func (*FieldRanges) CheckValid

func (p *FieldRanges) CheckValid(isMessageSet bool) error

CheckValid reports any errors with the set of ranges with an error message that completes the sentence: "ranges is invalid because it has ..."

func (*FieldRanges) Format

func (p *FieldRanges) Format(s fmt.State, r rune)

func (*FieldRanges) Get

func (p *FieldRanges) Get(i int) [2]protoreflect.FieldNumber

func (*FieldRanges) Has

func (*FieldRanges) Len

func (p *FieldRanges) Len() int

func (*FieldRanges) ProtoInternal

func (p *FieldRanges) ProtoInternal(pragma.DoNotImplement)

type Fields

type Fields struct {
	List []Field
	// contains filtered or unexported fields
}

func (*Fields) ByJSONName

func (p *Fields) ByJSONName(s string) protoreflect.FieldDescriptor

func (*Fields) ByName

func (*Fields) ByNumber

func (*Fields) ByTextName added in v1.26.0

func (p *Fields) ByTextName(s string) protoreflect.FieldDescriptor

func (*Fields) Format

func (p *Fields) Format(s fmt.State, r rune)

func (*Fields) Get

func (*Fields) Len

func (p *Fields) Len() int

func (*Fields) ProtoInternal

func (p *Fields) ProtoInternal(pragma.DoNotImplement)

type File

type File struct {
	L1 FileL1

	L2 *FileL2
	// contains filtered or unexported fields
}

func (*File) Edition added in v1.34.0

func (fd *File) Edition() int32

Not exported and just used to reconstruct the original FileDescriptor proto

func (*File) Enums

func (fd *File) Enums() protoreflect.EnumDescriptors

func (*File) Extensions

func (fd *File) Extensions() protoreflect.ExtensionDescriptors

func (*File) Format

func (fd *File) Format(s fmt.State, r rune)

func (*File) FullName

func (fd *File) FullName() protoreflect.FullName

func (*File) GoPackagePath

func (fd *File) GoPackagePath() string

GoPackagePath is a pseudo-internal API for determining the Go package path that this file descriptor is declared in.

WARNING: This method is exempt from the compatibility promise and may be removed in the future without warning.

func (*File) Imports

func (fd *File) Imports() protoreflect.FileImports

func (*File) Index

func (fd *File) Index() int

func (*File) IsPlaceholder

func (fd *File) IsPlaceholder() bool

func (*File) Messages

func (fd *File) Messages() protoreflect.MessageDescriptors

func (*File) Name

func (fd *File) Name() protoreflect.Name

func (*File) Options

func (fd *File) Options() protoreflect.ProtoMessage

func (*File) Package

func (fd *File) Package() protoreflect.FullName

func (*File) Parent

func (fd *File) Parent() protoreflect.Descriptor

func (*File) ParentFile

func (fd *File) ParentFile() protoreflect.FileDescriptor

func (*File) Path

func (fd *File) Path() string

func (*File) ProtoInternal

func (fd *File) ProtoInternal(pragma.DoNotImplement)

func (*File) ProtoType

func (fd *File) ProtoType(protoreflect.FileDescriptor)

func (*File) Services

func (fd *File) Services() protoreflect.ServiceDescriptors

func (*File) SourceLocations

func (fd *File) SourceLocations() protoreflect.SourceLocations

func (*File) Syntax

func (fd *File) Syntax() protoreflect.Syntax

type FileImports

type FileImports []protoreflect.FileImport

func (*FileImports) Format

func (p *FileImports) Format(s fmt.State, r rune)

func (*FileImports) Get

func (*FileImports) Len

func (p *FileImports) Len() int

func (*FileImports) ProtoInternal

func (p *FileImports) ProtoInternal(pragma.DoNotImplement)

type FileL1

type FileL1 struct {
	Syntax  protoreflect.Syntax
	Edition Edition // Only used if Syntax == Editions
	Path    string
	Package protoreflect.FullName

	Enums      Enums
	Messages   Messages
	Extensions Extensions
	Services   Services

	EditionFeatures EditionFeatures
}

type FileL2

type FileL2 struct {
	Options   func() protoreflect.ProtoMessage
	Imports   FileImports
	Locations SourceLocations
}

type Message

type Message struct {
	Base
	L1 MessageL1
	L2 *MessageL2 // protected by fileDesc.once
}

func (*Message) Enums

func (md *Message) Enums() protoreflect.EnumDescriptors

func (*Message) ExtensionRangeOptions

func (md *Message) ExtensionRangeOptions(i int) protoreflect.ProtoMessage

func (*Message) ExtensionRanges

func (md *Message) ExtensionRanges() protoreflect.FieldRanges

func (*Message) Extensions

func (md *Message) Extensions() protoreflect.ExtensionDescriptors

func (*Message) Fields

func (md *Message) Fields() protoreflect.FieldDescriptors

func (*Message) Format

func (md *Message) Format(s fmt.State, r rune)

func (*Message) IsMapEntry

func (md *Message) IsMapEntry() bool

func (*Message) IsMessageSet

func (md *Message) IsMessageSet() bool

IsMessageSet is a pseudo-internal API for checking whether a message should serialize in the proto1 message format.

WARNING: This method is exempt from the compatibility promise and may be removed in the future without warning.

func (*Message) Messages

func (md *Message) Messages() protoreflect.MessageDescriptors

func (*Message) Oneofs

func (md *Message) Oneofs() protoreflect.OneofDescriptors

func (*Message) Options

func (md *Message) Options() protoreflect.ProtoMessage

func (*Message) ProtoType

func (md *Message) ProtoType(protoreflect.MessageDescriptor)

func (*Message) RequiredNumbers

func (md *Message) RequiredNumbers() protoreflect.FieldNumbers

func (*Message) ReservedNames

func (md *Message) ReservedNames() protoreflect.Names

func (*Message) ReservedRanges

func (md *Message) ReservedRanges() protoreflect.FieldRanges

type MessageL1

type MessageL1 struct {
	Enums        Enums
	Messages     Messages
	Extensions   Extensions
	IsMapEntry   bool // promoted from google.protobuf.MessageOptions
	IsMessageSet bool // promoted from google.protobuf.MessageOptions

	EditionFeatures EditionFeatures
}

type MessageL2

type MessageL2 struct {
	Options               func() protoreflect.ProtoMessage
	Fields                Fields
	Oneofs                Oneofs
	ReservedNames         Names
	ReservedRanges        FieldRanges
	RequiredNumbers       FieldNumbers // must be consistent with Fields.Cardinality
	ExtensionRanges       FieldRanges
	ExtensionRangeOptions []func() protoreflect.ProtoMessage // must be same length as ExtensionRanges
}

type Messages

type Messages struct {
	List []Message
	// contains filtered or unexported fields
}

func (*Messages) ByName

func (*Messages) Format

func (p *Messages) Format(s fmt.State, r rune)

func (*Messages) Get

func (*Messages) Len

func (p *Messages) Len() int

func (*Messages) ProtoInternal

func (p *Messages) ProtoInternal(pragma.DoNotImplement)

type Method

type Method struct {
	Base
	L1 MethodL1
}

func (*Method) Format

func (md *Method) Format(s fmt.State, r rune)

func (*Method) Input

func (*Method) IsStreamingClient

func (md *Method) IsStreamingClient() bool

func (*Method) IsStreamingServer

func (md *Method) IsStreamingServer() bool

func (*Method) Options

func (md *Method) Options() protoreflect.ProtoMessage

func (*Method) Output

func (md *Method) Output() protoreflect.MessageDescriptor

func (*Method) ProtoInternal

func (md *Method) ProtoInternal(pragma.DoNotImplement)

func (*Method) ProtoType

func (md *Method) ProtoType(protoreflect.MethodDescriptor)

type MethodL1

type MethodL1 struct {
	Options           func() protoreflect.ProtoMessage
	Input             protoreflect.MessageDescriptor
	Output            protoreflect.MessageDescriptor
	IsStreamingClient bool
	IsStreamingServer bool
}

type Methods

type Methods struct {
	List []Method
	// contains filtered or unexported fields
}

func (*Methods) ByName

func (*Methods) Format

func (p *Methods) Format(s fmt.State, r rune)

func (*Methods) Get

func (*Methods) Len

func (p *Methods) Len() int

func (*Methods) ProtoInternal

func (p *Methods) ProtoInternal(pragma.DoNotImplement)

type Names

type Names struct {
	List []protoreflect.Name
	// contains filtered or unexported fields
}

func (*Names) CheckValid

func (p *Names) CheckValid() error

CheckValid reports any errors with the set of names with an error message that completes the sentence: "ranges is invalid because it has ..."

func (*Names) Format

func (p *Names) Format(s fmt.State, r rune)

func (*Names) Get

func (p *Names) Get(i int) protoreflect.Name

func (*Names) Has

func (p *Names) Has(s protoreflect.Name) bool

func (*Names) Len

func (p *Names) Len() int

func (*Names) ProtoInternal

func (p *Names) ProtoInternal(pragma.DoNotImplement)

type Oneof

type Oneof struct {
	Base
	L1 OneofL1
}

func (*Oneof) Fields

func (od *Oneof) Fields() protoreflect.FieldDescriptors

func (*Oneof) Format

func (od *Oneof) Format(s fmt.State, r rune)

func (*Oneof) IsSynthetic added in v1.22.0

func (od *Oneof) IsSynthetic() bool

func (*Oneof) Options

func (od *Oneof) Options() protoreflect.ProtoMessage

func (*Oneof) ProtoType

func (od *Oneof) ProtoType(protoreflect.OneofDescriptor)

type OneofFields

type OneofFields struct {
	List []protoreflect.FieldDescriptor
	// contains filtered or unexported fields
}

func (*OneofFields) ByJSONName

func (*OneofFields) ByName

func (*OneofFields) ByNumber

func (*OneofFields) ByTextName added in v1.26.0

func (*OneofFields) Format

func (p *OneofFields) Format(s fmt.State, r rune)

func (*OneofFields) Get

func (*OneofFields) Len

func (p *OneofFields) Len() int

func (*OneofFields) ProtoInternal

func (p *OneofFields) ProtoInternal(pragma.DoNotImplement)

type OneofL1

type OneofL1 struct {
	Options func() protoreflect.ProtoMessage
	Fields  OneofFields // must be consistent with Message.Fields.ContainingOneof

	EditionFeatures EditionFeatures
}

type Oneofs

type Oneofs struct {
	List []Oneof
	// contains filtered or unexported fields
}

func (*Oneofs) ByName

func (*Oneofs) Format

func (p *Oneofs) Format(s fmt.State, r rune)

func (*Oneofs) Get

func (*Oneofs) Len

func (p *Oneofs) Len() int

func (*Oneofs) ProtoInternal

func (p *Oneofs) ProtoInternal(pragma.DoNotImplement)

type Out

type Out struct {
	File protoreflect.FileDescriptor

	// Enums is all enum descriptors in "flattened ordering".
	Enums []Enum
	// Messages is all message descriptors in "flattened ordering".
	// It includes the implicit message declarations for map entries.
	Messages []Message
	// Extensions is all extension descriptors in "flattened ordering".
	Extensions []Extension
	// Service is all service descriptors in "flattened ordering".
	Services []Service
}

Out is the output of the Builder.

type PlaceholderEnum

type PlaceholderEnum protoreflect.FullName

PlaceholderEnum is a placeholder, representing only the full name.

func (PlaceholderEnum) FullName

func (e PlaceholderEnum) FullName() protoreflect.FullName

func (PlaceholderEnum) Index

func (e PlaceholderEnum) Index() int

func (PlaceholderEnum) IsClosed added in v1.34.0

func (e PlaceholderEnum) IsClosed() bool

func (PlaceholderEnum) IsPlaceholder

func (e PlaceholderEnum) IsPlaceholder() bool

func (PlaceholderEnum) Name

func (PlaceholderEnum) Options

func (PlaceholderEnum) Parent

func (PlaceholderEnum) ParentFile

func (PlaceholderEnum) ProtoInternal

func (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement)

func (PlaceholderEnum) ProtoType

func (PlaceholderEnum) ReservedNames

func (e PlaceholderEnum) ReservedNames() protoreflect.Names

func (PlaceholderEnum) ReservedRanges

func (e PlaceholderEnum) ReservedRanges() protoreflect.EnumRanges

func (PlaceholderEnum) Syntax

func (e PlaceholderEnum) Syntax() protoreflect.Syntax

func (PlaceholderEnum) Values

type PlaceholderEnumValue

type PlaceholderEnumValue protoreflect.FullName

PlaceholderEnumValue is a placeholder, representing only the full name.

func (PlaceholderEnumValue) FullName

func (PlaceholderEnumValue) Index

func (e PlaceholderEnumValue) Index() int

func (PlaceholderEnumValue) IsPlaceholder

func (e PlaceholderEnumValue) IsPlaceholder() bool

func (PlaceholderEnumValue) Name

func (PlaceholderEnumValue) Number

func (PlaceholderEnumValue) Options

func (PlaceholderEnumValue) Parent

func (PlaceholderEnumValue) ParentFile

func (PlaceholderEnumValue) ProtoInternal

func (e PlaceholderEnumValue) ProtoInternal(pragma.DoNotImplement)

func (PlaceholderEnumValue) ProtoType

func (PlaceholderEnumValue) Syntax

type PlaceholderFile

type PlaceholderFile string

PlaceholderFile is a placeholder, representing only the file path.

func (PlaceholderFile) Enums

func (PlaceholderFile) Extensions

func (PlaceholderFile) FullName

func (f PlaceholderFile) FullName() protoreflect.FullName

func (PlaceholderFile) Imports

func (PlaceholderFile) Index

func (f PlaceholderFile) Index() int

func (PlaceholderFile) IsPlaceholder

func (f PlaceholderFile) IsPlaceholder() bool

func (PlaceholderFile) Messages

func (PlaceholderFile) Name

func (PlaceholderFile) Options

func (PlaceholderFile) Package

func (PlaceholderFile) Parent

func (PlaceholderFile) ParentFile

func (PlaceholderFile) Path

func (f PlaceholderFile) Path() string

func (PlaceholderFile) ProtoInternal

func (f PlaceholderFile) ProtoInternal(pragma.DoNotImplement)

func (PlaceholderFile) ProtoType

func (PlaceholderFile) Services

func (PlaceholderFile) SourceLocations

func (f PlaceholderFile) SourceLocations() protoreflect.SourceLocations

func (PlaceholderFile) Syntax

func (f PlaceholderFile) Syntax() protoreflect.Syntax

type PlaceholderMessage

type PlaceholderMessage protoreflect.FullName

PlaceholderMessage is a placeholder, representing only the full name.

func (PlaceholderMessage) Enums

func (PlaceholderMessage) ExtensionRangeOptions

func (m PlaceholderMessage) ExtensionRangeOptions(int) protoreflect.ProtoMessage

func (PlaceholderMessage) ExtensionRanges

func (m PlaceholderMessage) ExtensionRanges() protoreflect.FieldRanges

func (PlaceholderMessage) Extensions

func (PlaceholderMessage) Fields

func (PlaceholderMessage) FullName

func (PlaceholderMessage) Index

func (m PlaceholderMessage) Index() int

func (PlaceholderMessage) IsMapEntry

func (m PlaceholderMessage) IsMapEntry() bool

func (PlaceholderMessage) IsPlaceholder

func (m PlaceholderMessage) IsPlaceholder() bool

func (PlaceholderMessage) Messages

func (PlaceholderMessage) Name

func (PlaceholderMessage) Oneofs

func (PlaceholderMessage) Options

func (PlaceholderMessage) Parent

func (PlaceholderMessage) ParentFile

func (PlaceholderMessage) ProtoInternal

func (m PlaceholderMessage) ProtoInternal(pragma.DoNotImplement)

func (PlaceholderMessage) ProtoType

func (PlaceholderMessage) RequiredNumbers

func (m PlaceholderMessage) RequiredNumbers() protoreflect.FieldNumbers

func (PlaceholderMessage) ReservedNames

func (m PlaceholderMessage) ReservedNames() protoreflect.Names

func (PlaceholderMessage) ReservedRanges

func (m PlaceholderMessage) ReservedRanges() protoreflect.FieldRanges

func (PlaceholderMessage) Syntax

type Service

type Service struct {
	Base
	L1 ServiceL1
	L2 *ServiceL2 // protected by fileDesc.once
}

func (*Service) Format

func (sd *Service) Format(s fmt.State, r rune)

func (*Service) Methods

func (sd *Service) Methods() protoreflect.MethodDescriptors

func (*Service) Options

func (sd *Service) Options() protoreflect.ProtoMessage

func (*Service) ProtoInternal

func (sd *Service) ProtoInternal(pragma.DoNotImplement)

func (*Service) ProtoType

func (sd *Service) ProtoType(protoreflect.ServiceDescriptor)

type ServiceL1

type ServiceL1 struct{}

type ServiceL2

type ServiceL2 struct {
	Options func() protoreflect.ProtoMessage
	Methods Methods
}

type Services

type Services struct {
	List []Service
	// contains filtered or unexported fields
}

func (*Services) ByName

func (*Services) Format

func (p *Services) Format(s fmt.State, r rune)

func (*Services) Get

func (*Services) Len

func (p *Services) Len() int

func (*Services) ProtoInternal

func (p *Services) ProtoInternal(pragma.DoNotImplement)

type SourceLocations

type SourceLocations struct {
	// List is a list of SourceLocations.
	// The SourceLocation.Next field does not need to be populated
	// as it will be lazily populated upon first need.
	List []protoreflect.SourceLocation

	// File is the parent file descriptor that these locations are relative to.
	// If non-nil, ByDescriptor verifies that the provided descriptor
	// is a child of this file descriptor.
	File protoreflect.FileDescriptor
	// contains filtered or unexported fields
}

func (*SourceLocations) ByDescriptor added in v1.26.0

func (*SourceLocations) ByPath added in v1.26.0

func (*SourceLocations) Get

func (*SourceLocations) Len

func (p *SourceLocations) Len() int

func (*SourceLocations) ProtoInternal

func (p *SourceLocations) ProtoInternal(pragma.DoNotImplement)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL