protobuf

package
v0.0.0-...-21fe71f Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package protobuf generates Protocol Buffers schema from the intermediate representation passed by the transpiler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PopulateSourceInfoMap

func PopulateSourceInfoMap(fd *descriptorpb.FileDescriptorProto, m SourceInfoMap)

PopulateSourceInfoMap populates the given SourceInfoMap with information from the given file descriptor.

func RecomputeSourceInfo

func RecomputeSourceInfo(c SourceInfoComputer)

RecomputeSourceInfo is used to initiate recomputation of source info. This is is used by the protoparse package, after it interprets options.

Types

type Comment

type Comment struct {
	LeadingDetachedComments []string
	LeadingComments         string
	TrailingComments        string
}

type EnumDescriptorProto

type EnumDescriptorProto struct {
	// contains filtered or unexported fields
}

func NewEnumDescriptorProto

func NewEnumDescriptorProto(name string) *EnumDescriptorProto

func (*EnumDescriptorProto) AddLeadingComment

func (ed *EnumDescriptorProto) AddLeadingComment(fn, leading string) *EnumDescriptorProto

func (*EnumDescriptorProto) AddLeadingDetachedComment

func (ed *EnumDescriptorProto) AddLeadingDetachedComment(leadingDetached []string) *EnumDescriptorProto

func (*EnumDescriptorProto) AddTrailingComment

func (ed *EnumDescriptorProto) AddTrailingComment(trailing string) *EnumDescriptorProto

func (*EnumDescriptorProto) AddValue

func (*EnumDescriptorProto) Build

func (*EnumDescriptorProto) GetComment

func (ed *EnumDescriptorProto) GetComment() Comment

func (*EnumDescriptorProto) GetName

func (ed *EnumDescriptorProto) GetName() string

func (*EnumDescriptorProto) GetValue

type EnumValueDescriptorProto

type EnumValueDescriptorProto struct {
	// contains filtered or unexported fields
}

func NewEnumValueDescriptorProto

func NewEnumValueDescriptorProto(name string, number int32) *EnumValueDescriptorProto

func (*EnumValueDescriptorProto) Build

func (*EnumValueDescriptorProto) GetName

func (evd *EnumValueDescriptorProto) GetName() string

func (*EnumValueDescriptorProto) SetDeprecated

func (evd *EnumValueDescriptorProto) SetDeprecated() *EnumValueDescriptorProto

type EnumValues

type EnumValues []*EnumValueDescriptorProto

func (EnumValues) Build

type FieldDescriptorProto

type FieldDescriptorProto struct {
	// contains filtered or unexported fields
}

func NewFieldDescriptorProto

func NewFieldDescriptorProto(name string, fieldType *descriptorpb.FieldDescriptorProto_Type) *FieldDescriptorProto

func (*FieldDescriptorProto) AddLeadingComment

func (fid *FieldDescriptorProto) AddLeadingComment(fn, leading string) *FieldDescriptorProto

func (*FieldDescriptorProto) AddLeadingDetachedComment

func (fid *FieldDescriptorProto) AddLeadingDetachedComment(leadingDetached []string) *FieldDescriptorProto

func (*FieldDescriptorProto) AddTrailingComment

func (fid *FieldDescriptorProto) AddTrailingComment(trailing string) *FieldDescriptorProto

func (*FieldDescriptorProto) Build

func (*FieldDescriptorProto) GetComment

func (fid *FieldDescriptorProto) GetComment() *Comment

func (*FieldDescriptorProto) GetName

func (fid *FieldDescriptorProto) GetName() string

func (*FieldDescriptorProto) GetNumber

func (fid *FieldDescriptorProto) GetNumber() int32

func (*FieldDescriptorProto) GetTypeName

func (fid *FieldDescriptorProto) GetTypeName() *string

func (*FieldDescriptorProto) HasComment

func (fid *FieldDescriptorProto) HasComment() bool

func (*FieldDescriptorProto) SetFieldOption

func (fid *FieldDescriptorProto) SetFieldOption(fieldOptions *descriptorpb.FieldOptions) *FieldDescriptorProto

func (*FieldDescriptorProto) SetJsonName

func (fid *FieldDescriptorProto) SetJsonName(jsonName string) *FieldDescriptorProto

func (*FieldDescriptorProto) SetNumber

func (fid *FieldDescriptorProto) SetNumber() *FieldDescriptorProto

func (*FieldDescriptorProto) SetOneofIndex

func (fid *FieldDescriptorProto) SetOneofIndex(idx int32) *FieldDescriptorProto

func (*FieldDescriptorProto) SetProto3Optional

func (fid *FieldDescriptorProto) SetProto3Optional() *FieldDescriptorProto

func (*FieldDescriptorProto) SetRepeated

func (fid *FieldDescriptorProto) SetRepeated() *FieldDescriptorProto

func (*FieldDescriptorProto) SetTypeName

func (fid *FieldDescriptorProto) SetTypeName(name string) *FieldDescriptorProto

type FileDescriptorProto

type FileDescriptorProto struct {
	// contains filtered or unexported fields
}

func NewFileDescriptorProto

func NewFileDescriptorProto(fqn string) *FileDescriptorProto

func (*FileDescriptorProto) AddComponent

func (fd *FileDescriptorProto) AddComponent(name string)

func (*FileDescriptorProto) AddDependency

func (fd *FileDescriptorProto) AddDependency(deps string) *FileDescriptorProto

func (*FileDescriptorProto) AddEnum

func (*FileDescriptorProto) AddExtension

func (*FileDescriptorProto) AddMessage

func (*FileDescriptorProto) AddMessageDescriptor

func (fd *FileDescriptorProto) AddMessageDescriptor(desc *descriptorpb.DescriptorProto) *FileDescriptorProto

func (*FileDescriptorProto) AddPackageLeadingComments

func (fd *FileDescriptorProto) AddPackageLeadingComments(comments string)

func (*FileDescriptorProto) AddService

func (*FileDescriptorProto) AddSourceCodeInfoLocation

func (fd *FileDescriptorProto) AddSourceCodeInfoLocation(loc *descriptorpb.SourceCodeInfo_Location) *FileDescriptorProto

func (*FileDescriptorProto) Build

func (*FileDescriptorProto) GetDependency

func (fd *FileDescriptorProto) GetDependency() []string

func (*FileDescriptorProto) GetName

func (fd *FileDescriptorProto) GetName() string

func (*FileDescriptorProto) HasComponent

func (fd *FileDescriptorProto) HasComponent(name string) bool

func (*FileDescriptorProto) SetName

func (fd *FileDescriptorProto) SetName(name string)

func (*FileDescriptorProto) SetPackage

func (fd *FileDescriptorProto) SetPackage(fqn string)

type MessageDescriptorProto

type MessageDescriptorProto struct {
	// contains filtered or unexported fields
}

func NewMessageDescriptorProto

func NewMessageDescriptorProto(name string) *MessageDescriptorProto

func (*MessageDescriptorProto) AddEnumType

func (*MessageDescriptorProto) AddExtension

func (*MessageDescriptorProto) AddField

func (*MessageDescriptorProto) AddLeadingComment

func (md *MessageDescriptorProto) AddLeadingComment(fn, leading string) *MessageDescriptorProto

func (*MessageDescriptorProto) AddLeadingDetachedComment

func (md *MessageDescriptorProto) AddLeadingDetachedComment(leadingDetached []string) *MessageDescriptorProto

func (*MessageDescriptorProto) AddNestedMessage

func (*MessageDescriptorProto) AddOneof

func (*MessageDescriptorProto) AddTrailingComment

func (md *MessageDescriptorProto) AddTrailingComment(trailing string) *MessageDescriptorProto

func (*MessageDescriptorProto) Build

func (*MessageDescriptorProto) GetComment

func (md *MessageDescriptorProto) GetComment() *Comment

func (*MessageDescriptorProto) GetFieldByName

func (md *MessageDescriptorProto) GetFieldByName(name string) *FieldDescriptorProto

func (*MessageDescriptorProto) GetFieldLocations

func (md *MessageDescriptorProto) GetFieldLocations() []*descriptorpb.SourceCodeInfo_Location

func (*MessageDescriptorProto) GetFieldOrder

func (md *MessageDescriptorProto) GetFieldOrder() []string

func (*MessageDescriptorProto) GetFieldType

func (*MessageDescriptorProto) GetName

func (md *MessageDescriptorProto) GetName() string

func (*MessageDescriptorProto) GetNestedMessages

func (md *MessageDescriptorProto) GetNestedMessages() []string

func (*MessageDescriptorProto) GetOneofIndex

func (md *MessageDescriptorProto) GetOneofIndex() int32

func (*MessageDescriptorProto) HasNestedMessage

func (md *MessageDescriptorProto) HasNestedMessage(nested string) bool

func (*MessageDescriptorProto) IsEmptyField

func (md *MessageDescriptorProto) IsEmptyField() bool

func (*MessageDescriptorProto) SetDeprecated

func (md *MessageDescriptorProto) SetDeprecated(deprecated bool) *MessageDescriptorProto

func (*MessageDescriptorProto) SetExtensionRange

func (*MessageDescriptorProto) SetMapEntry

func (md *MessageDescriptorProto) SetMapEntry(mapEntry bool) *MessageDescriptorProto

func (*MessageDescriptorProto) SetMessageOptions

func (*MessageDescriptorProto) SetMessageSetWireFormat

func (md *MessageDescriptorProto) SetMessageSetWireFormat(messageSetWireFormat bool) *MessageDescriptorProto

func (*MessageDescriptorProto) SetName

func (*MessageDescriptorProto) SetNoStandardDescriptorAccessor

func (md *MessageDescriptorProto) SetNoStandardDescriptorAccessor(noStandardDescriptorAccessor bool) *MessageDescriptorProto

func (*MessageDescriptorProto) SetReservedRange

func (*MessageDescriptorProto) SortField

func (md *MessageDescriptorProto) SortField(order []string) *MessageDescriptorProto

type MethodDescriptorProto

type MethodDescriptorProto struct {
	// contains filtered or unexported fields
}

func NewMethodDescriptorProto

func NewMethodDescriptorProto(name, input, output string) *MethodDescriptorProto

func (*MethodDescriptorProto) AddLeadingComment

func (sd *MethodDescriptorProto) AddLeadingComment(fn, leading string) *MethodDescriptorProto

func (*MethodDescriptorProto) AddLeadingDetachedComment

func (sd *MethodDescriptorProto) AddLeadingDetachedComment(leadingDetached []string) *MethodDescriptorProto

func (*MethodDescriptorProto) AddTrailingComment

func (sd *MethodDescriptorProto) AddTrailingComment(trailing string) *MethodDescriptorProto

func (*MethodDescriptorProto) Build

func (*MethodDescriptorProto) GetComment

func (sd *MethodDescriptorProto) GetComment() *Comment

func (*MethodDescriptorProto) GetName

func (sd *MethodDescriptorProto) GetName() string

func (*MethodDescriptorProto) SetMethodOptions

type OneofDescriptorProto

type OneofDescriptorProto struct {
	// contains filtered or unexported fields
}

func NewOneofDescriptorProto

func NewOneofDescriptorProto(name string) *OneofDescriptorProto

func (*OneofDescriptorProto) Build

func (*OneofDescriptorProto) GetName

func (md *OneofDescriptorProto) GetName() string

type ServiceDescriptorProto

type ServiceDescriptorProto struct {
	// contains filtered or unexported fields
}

func NewServiceDescriptorProto

func NewServiceDescriptorProto(name string) *ServiceDescriptorProto

func (*ServiceDescriptorProto) AddLeadingComment

func (sd *ServiceDescriptorProto) AddLeadingComment(fn, leading string) *ServiceDescriptorProto

func (*ServiceDescriptorProto) AddLeadingDetachedComment

func (sd *ServiceDescriptorProto) AddLeadingDetachedComment(leadingDetached []string) *ServiceDescriptorProto

func (*ServiceDescriptorProto) AddMethod

func (*ServiceDescriptorProto) AddTrailingComment

func (sd *ServiceDescriptorProto) AddTrailingComment(trailing string) *ServiceDescriptorProto

func (*ServiceDescriptorProto) Build

func (*ServiceDescriptorProto) GetComment

func (sd *ServiceDescriptorProto) GetComment() *Comment

func (*ServiceDescriptorProto) GetName

func (sd *ServiceDescriptorProto) GetName() string

func (*ServiceDescriptorProto) SetServiceOptions

type SourceInfoComputeFunc

type SourceInfoComputeFunc func()

SourceInfoComputeFunc is the type that a desc.Descriptor will embed. It will be aliased in the desc package to an unexported name so it is not marked as an exported field in reflection and not present in Go docs.

type SourceInfoComputer

type SourceInfoComputer interface {
	// contains filtered or unexported methods
}

SourceInfoComputer is a single method which will be invoked to recompute source info. This is needed for the protoparse package, which needs to link descriptors without source info in order to interpret options, but then needs to re-compute source info after that interpretation so that final linked descriptors expose the right info.

type SourceInfoMap

type SourceInfoMap map[string][]*descriptorpb.SourceCodeInfo_Location

SourceInfoMap is a map of paths in a descriptor to the corresponding source code info.

func CreateSourceInfoMap

func CreateSourceInfoMap(fd *descriptorpb.FileDescriptorProto) SourceInfoMap

CreateSourceInfoMap constructs a new SourceInfoMap and populates it with the source code info in the given file descriptor proto.

func (SourceInfoMap) Add

Add stores the given source code info for the given path.

func (SourceInfoMap) Get

Get returns the source code info for the given path. If there are multiple locations for the same path, the first one is returned.

func (SourceInfoMap) GetAll

GetAll returns all source code info for the given path.

func (SourceInfoMap) PutIfAbsent

func (m SourceInfoMap) PutIfAbsent(path []int32, loc *descriptorpb.SourceCodeInfo_Location) bool

PutIfAbsent stores the given source code info for the given path only if the given path does not exist in the map. This method returns true when the value is stored, false if the path already exists.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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