parser

package
v1.5.18 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: GPL-3.0 Imports: 9 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrGoPackage = errors.New(`option go_package = "" field is not filled in`)

Functions

func CamelCase

func CamelCase(s string) string

CamelCase copy from protobuf, for more information, please see github.com/golang/protobuf@v1.4.2/protoc-gen-go/generator/generator.go:2648

func GetComment

func GetComment(comment *proto.Comment) string

GetComment returns content with prefix //

func GoSanitized

func GoSanitized(s string) string

GoSanitized copy from protobuf, for more information, please see google.golang.org/protobuf@v1.25.0/internal/strs/strings.go:71

Types

type DefaultProtoParser

type DefaultProtoParser struct{}

DefaultProtoParser types an empty struct

func NewDefaultProtoParser

func NewDefaultProtoParser() *DefaultProtoParser

NewDefaultProtoParser creates a new instance

func (*DefaultProtoParser) Parse

func (p *DefaultProtoParser) Parse(src string, multiple ...bool) (Proto, error)

Parse provides to parse the proto file into a golang structure, which is convenient for subsequent rpc generation and use

type Enum

type Enum struct {
	*proto.Enum
}

Enum embeds proto.Enum

type Import

type Import struct {
	*proto.Import
}

Import embeds proto.Import

type Message

type Message struct {
	*proto.Message
}

Message embeds proto.Message

type Option

type Option struct {
	*proto.Option
}

Option embeds proto.Option

type Package

type Package struct {
	*proto.Package
}

Package defines the protobuf package.

type Proto

type Proto struct {
	Src       string
	Name      string
	Package   Package
	PbPackage string
	GoPackage string
	Import    []Import
	Enum      []Enum
	Message   []Message
	Service   Services
}

Proto describes a proto file,

type RPC

type RPC struct {
	*proto.RPC
}

RPC embeds proto.RPC

type Service

type Service struct {
	*proto.Service
	RPC []*RPC
}

Service describes the rpc service, which is the relevant content after the translation of the proto file

type Services

type Services []Service

Services is a slice of Service.

Jump to

Keyboard shortcuts

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