parser

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Enum

type Enum interface {
	Protobuf() *protobuf.Enum

	GetFieldByName(name string) (*EnumField, bool)

	GetFieldByLine(line int) (*EnumField, bool)
}

Enum is a registry for protobuf enum.

func NewEnum

func NewEnum(protoEnum *protobuf.Enum) Enum

NewEnum returns Enum initialized by provided *protobuf.Enum.

type EnumField

type EnumField struct {
	ProtoEnumField *protobuf.EnumField
}

EnumField is a registry for protobuf enum field.

func NewEnumField

func NewEnumField(protoMessage *protobuf.EnumField) *EnumField

NewEnumField returns EnumField initialized by provided *protobuf.EnumField.

type Import

type Import struct {
	ProtoImport *protobuf.Import
}

Import is a registry for protobuf enum field.

func NewImport

func NewImport(protoImport *protobuf.Import) *Import

NewImport returns MapField initialized by provided *protobuf.MapField.

type MapField

type MapField struct {
	ProtoMapField *protobuf.MapField
}

MapField is a registry for protobuf enum field.

func NewMapField

func NewMapField(protoMapField *protobuf.MapField) *MapField

NewMapField returns MapField initialized by provided *protobuf.MapField.

type Message

type Message interface {
	Protobuf() *protobuf.Message

	NestedMessages() []Message
	NestedEnums() []Enum
	Fields() []*MessageField
	Oneofs() []Oneof
	MapFields() []*MapField

	GetNestedMessageByName(name string) (Message, bool)
	GetNestedEnumByName(name string) (Enum, bool)

	GetFieldByName(name string) (*MessageField, bool)
	GetOneofFieldByName(name string) (Oneof, bool)
	GetMapFieldByName(name string) (*MapField, bool)

	GetFieldByLine(line int) (*MessageField, bool)
	GetOneofFieldByLine(line int) (Oneof, bool)
	GetMapFieldByLine(line int) (*MapField, bool)

	GetParentMessage() Message
	SetParentMessage(Message)
}

Message is a registry for protobuf message.

func NewMessage

func NewMessage(protoMessage *protobuf.Message) Message

NewMessage returns Message initialized by provided *protobuf.Message.

type MessageField

type MessageField struct {
	ProtoField *protobuf.NormalField
}

MessageField is a registry for protobuf message field.

func NewMessageField

func NewMessageField(protoMessage *protobuf.NormalField) *MessageField

NewMessageField returns MessageField initialized by provided *protobuf.MessageField.

type Oneof

type Oneof interface {
	Protobuf() *protobuf.Oneof

	GetFieldByName(name string) (*OneofField, bool)

	GetFieldByLine(line int) (*OneofField, bool)
}

Oneof is a registry for protobuf oneof.

func NewOneof

func NewOneof(protoOneofField *protobuf.Oneof) Oneof

NewOneof returns Oneof initialized by provided *protobuf.Oneof.

type OneofField

type OneofField struct {
	ProtoOneOfField *protobuf.OneOfField
}

OneofField is a registry for protobuf oneof field.

func NewOneofField

func NewOneofField(protoOneOfField *protobuf.OneOfField) *OneofField

NewOneofField returns OneofField initialized by provided *protobuf.OneofField.

type Package

type Package struct {
	ProtoPackage *protobuf.Package
}

Package is a registry for protobuf package.

func NewPackage

func NewPackage(protoPackage *protobuf.Package) *Package

NewPackage returns Package initialized by provided *protobuf.Package.

type Proto

type Proto interface {
	Protobuf() *protobuf.Proto

	Packages() []*Package
	Messages() []Message
	Enums() []Enum
	Services() []Service
	Imports() []*Import

	GetPackageByName(name string) (*Package, bool)
	GetMessageByName(name string) (Message, bool)
	GetEnumByName(name string) (Enum, bool)
	GetServiceByName(name string) (Service, bool)

	GetPackageByLine(line int) (*Package, bool)
	GetMessageByLine(line int) (Message, bool)
	GetEnumByLine(line int) (Enum, bool)
	GetServiceByLine(line int) (Service, bool)

	GetMessageFieldByLine(line int) (*MessageField, bool)
	GetEnumFieldByLine(line int) (*EnumField, bool)

	GetAllParentMessage(line int) []Message
	GetAllParentEnum(line int) []Enum
}

Proto is a registry for protobuf proto.

func NewProto

func NewProto(document_uri defines.DocumentUri, protoProto *protobuf.Proto) Proto

NewProto returns Proto initialized by provided *protobuf.Proto.

func ParseProto

func ParseProto(document_uri defines.DocumentUri, r io.Reader) (Proto, error)

ParseProtos parses protobuf files from filenames and return parser.ProtoSet.

type RPC

type RPC struct {
	ProtoRPC *protobuf.RPC
}

RPC is a registry for protobuf rpc.

func NewRPC

func NewRPC(protoRPC *protobuf.RPC) *RPC

NewRPC returns RPC initialized by provided *protobuf.RPC.

type Service

type Service interface {
	Protobuf() *protobuf.Service

	RPCs() []*RPC

	GetRPCByName(bool string) (*RPC, bool)

	GetRPCByLine(line int) (*RPC, bool)
}

Service is a registry for protobuf service.

func NewService

func NewService(protoService *protobuf.Service) Service

NewService returns Service initialized by provided *protobuf.Service.

Jump to

Keyboard shortcuts

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