proto_reader

package
v0.0.0-...-54a64e2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayOption

type ArrayOption struct {
	Key   string
	Value []Option
}

func (*ArrayOption) Name

func (this *ArrayOption) Name() string

type ConstOption

type ConstOption struct {
	Key   string
	Value string
}

func (*ConstOption) Name

func (this *ConstOption) Name() string

type Enum

type Enum struct {
	Name  string
	Items []EnumEntry
}

type EnumEntry

type EnumEntry struct {
	Name  string
	Index int
}

type Field

type Field struct {
	Name       string
	Type       string
	IsRepeated bool
	IsMap      bool
	SubType    *string
	Comment    string
	Options    []Option
}

func (*Field) TypeString

func (this *Field) TypeString() string

type FileReader

type FileReader interface {
	ReadAll(filePath string) string
}

type LocalFileReader

type LocalFileReader struct {
}

func (*LocalFileReader) ReadAll

func (this *LocalFileReader) ReadAll(filePath string) string

type MapOption

type MapOption struct {
	Key   string
	Value map[string]Option
}

func (*MapOption) Name

func (this *MapOption) Name() string

type Message

type Message struct {
	Name    string
	Fields  map[string]*Field
	Comment string
	Options []Option
}

type Method

type Method struct {
	Name            string
	Input           *Message
	Output          *Message
	StreamingInput  bool
	StreamingOutput bool
	Comment         string
	Options         []Option
}

type Option

type Option interface {
	Name() string
}

type ParseResult

type ParseResult struct {
	Messages map[string]*proto.Message
	Services map[string]*proto.Service
	Methods  map[string]*proto.RPC
	Options  map[string][]*proto.Option
	Enums    map[string]*proto.Enum
	Imports  map[string]*proto.Import
	Package  string
}

type ParserFactory

type ParserFactory = func() ProtobufParser

type ProtobufDefinition

type ProtobufDefinition struct {
	Messages map[string]*Message
	Services map[string]*Service
	Enums    map[string]*Enum
	Options  []Option
}

type ProtobufParser

type ProtobufParser interface {
	Parse(protoText string) (*ParseResult, error)
}

func NewProtobufParser

func NewProtobufParser() ProtobufParser

type ProtobufReader

type ProtobufReader interface {
	Read(protoText string) (*ProtobufDefinition, error)
	ReadFile(protoFile, importPath string) (*ProtobufDefinition, error)
	ReadFileCustom(protoFile, importPath string, fileReader FileReader) (*ProtobufDefinition, error)
}

func NewProtobufReader

func NewProtobufReader(parserFactory ParserFactory) ProtobufReader

func NewReader

func NewReader() ProtobufReader

type Service

type Service struct {
	Name    string
	Methods map[string]*Method
	Comment string
	Options []Option
}

Jump to

Keyboard shortcuts

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