parser

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnyImport = "google/protobuf/any.proto"
)

Variables

This section is empty.

Functions

func MustNewAstParser added in v1.0.21

func MustNewAstParser(proto *Proto, log console.Console) *astParser

Types

type ConstLit added in v1.0.21

type ConstLit struct {
	Name     stringx.String
	Document []string
	Comment  []string
	Lit      []*Lit
}

type Enum added in v1.0.21

type Enum struct {
	Name    stringx.String
	Element []*EnumField
	*proto.Enum
}

func (*Enum) GenEnumCode added in v1.0.21

func (e *Enum) GenEnumCode() (string, error)

func (*Enum) GenEnumTypeCode added in v1.0.21

func (e *Enum) GenEnumTypeCode() (string, error)

type EnumField added in v1.0.21

type EnumField struct {
	Key   string
	Value int
}

func (*EnumField) GenEnumFieldCode added in v1.0.21

func (e *EnumField) GenEnumFieldCode(parentName string) (string, error)

type Field

type Field struct {
	Name     stringx.String
	Type     Type
	JsonTag  string
	Document []string
	Comment  []string
}

type Func

type Func struct {
	Name         stringx.String
	ParameterIn  Type
	ParameterOut Type
	Document     []string
}

func (*Func) GetDoc added in v1.0.21

func (f *Func) GetDoc() string

func (*Func) HaveDoc added in v1.0.21

func (f *Func) HaveDoc() bool

type Import added in v1.0.21

type Import struct {
	ProtoImportName   string
	PbImportName      string
	OriginalDir       string
	OriginalProtoPath string
	OriginalPbPath    string
	BridgeImport      string
	// contains filtered or unexported fields
}

func ParseImport added in v1.0.21

func ParseImport(src string) ([]*Import, bool, error)

type Lit added in v1.0.21

type Lit struct {
	Key   string
	Value int
}

type Message added in v1.0.21

type Message struct {
	Name    stringx.String
	Element []*MessageField
	*proto.Message
}

type MessageField added in v1.0.21

type MessageField struct {
	Type string
	Name stringx.String
}

type PbAst

type PbAst struct {
	ContainsAny bool
	Imports     map[string]string
	Structure   map[string]*Struct
	Service     []*RpcService
	*Proto
}

parsing for rpc

func Transfer added in v1.0.21

func Transfer(proto, target string, externalImport []*Import, console console.Console) (*PbAst, error)

func (*PbAst) GenEnumCode added in v1.0.21

func (a *PbAst) GenEnumCode() (string, error)

func (*PbAst) GenTypesCode

func (a *PbAst) GenTypesCode() (string, error)

type Proto added in v1.0.21

type Proto struct {
	Package     string
	Import      []*Import
	PbSrc       string
	ContainsAny bool
	Message     map[string]lang.PlaceholderType
	Enum        map[string]*Enum
}

type RpcService

type RpcService struct {
	Name  stringx.String
	Funcs []*Func
}

type Struct

type Struct struct {
	Name     stringx.String
	Document []string
	Comment  []string
	Field    []*Field
}

type Type added in v1.0.21

type Type struct {
	// eg:context.Context
	Expression string
	// eg: *context.Context
	StarExpression string
	// Invoke Type Expression
	InvokeTypeExpression string
	// eg:context
	Package string
	// eg:Context
	Name string
}

Jump to

Keyboard shortcuts

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