parser

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

parse package and generate interface

Get the message definitions by parsing a proto file No go files

copy from encoding/json

go type

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateChiRoutes

func GenerateChiRoutes(path string, pkg *Package, dep map[string]*Package) error

GenerateRoutes generate routes for package using template.

func GenerateDartCode

func GenerateDartCode(path string, pkg *Package, dep map[string]*Package) error

GenerateDartCode generate dart code

func GenerateGsrv

func GenerateGsrv(path string, modulePath string, pkg *Package, dep map[string]*Package) error

GenerateGsrv generate grpc server

func GenerateProtoFile

func GenerateProtoFile(path string, moduleBasePath string, pkg *Package, dep map[string]*Package) error

func GenerateSwiftCode

func GenerateSwiftCode(path string, pkg *Package, _ map[string]*Package) error

GenerateSwiftCode generate swift code

func GenerateTSAngularDelonCode

func GenerateTSAngularDelonCode(path string, pkg *Package, dep map[string]*Package) error

func GenerateTSCode

func GenerateTSCode(path string, pkg *Package, dep map[string]*Package) error

GenerateTSCode generate ts code

func GetModulePath

func GetModulePath(root string) string

func ParseProtoFile

func ParseProtoFile(path string) (*protoParser, error)

func VisitNormalField

func VisitNormalField(m *proto.NormalField)

Types

type Field

type Field struct {
	Name      string
	JSON      string
	Type      string
	Omitempty bool
	Comments  []string
	Options   map[string]string
}

type Method

type Method struct {
	Name      string
	Type      MethodType
	Comments  []string
	Args      []Field
	Rets      []Field
	Filename  string
	StartLine int
}

type MethodArr

type MethodArr []Method

func (MethodArr) Len

func (a MethodArr) Len() int

func (MethodArr) Less

func (a MethodArr) Less(i, j int) bool

func (MethodArr) Swap

func (a MethodArr) Swap(i, j int)

type MethodType

type MethodType uint8
const (
	MT_NORMAL MethodType = iota
	MT_S2C
	MT_C2S
	MT_BIDI
)

type Package

type Package struct {
	Name       string
	Imports    []string
	ImportsMap map[string]string
	Structs    []Struct
}

func ParsePackage

func ParsePackage(path string, modulePath string) (*Package, error)

Path is the path of the package modulePath is the name of the module which the package belongs to

func (*Package) Sort

func (p *Package) Sort()

type Struct

type Struct struct {
	Name     string
	Comments []string
	Fields   []Field
	Methods  []Method
	Options  map[string]string
}

func FindStruct

func FindStruct(pkg *Package, name string) *Struct

type StructArr

type StructArr []Struct

func (StructArr) Len

func (a StructArr) Len() int

func (StructArr) Less

func (a StructArr) Less(i, j int) bool

func (StructArr) Swap

func (a StructArr) Swap(i, j int)

Jump to

Keyboard shortcuts

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