Documentation
¶
Overview ¶
Package protoanalysis provides a toolset for analyzing proto files and packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrImportNotFound = errors.New("proto import not found")
ErrImportNotFound returned when proto file import cannot be found.
Functions ¶
func HasMessages ¶
HasMessages checks if the proto package under path contains messages with given names.
func IsImported ¶
IsImported checks if the proto package under path imports list of dependencies.
Types ¶
type File ¶
type HTTPRule ¶
type HTTPRule struct {
// Params is a list of parameters defined in the http endpoint itself.
Params []string
// HasQuery indicates if there is a request query.
HasQuery bool
// HasBody indicates if there is a request payload.
HasBody bool
}
HTTPRule keeps info about a configured http rule of an RPC func.
type Message ¶
type Message struct {
// Name of the message.
Name string
// Path of the file where message is defined at.
Path string
// HighestFieldNumber is the highest field number among fields of the message
// This allows to determine new field number when writing to proto message
HighestFieldNumber int
}
Message represents a proto message.
type Package ¶
type Package struct {
// Name of the proto pkg.
Name string
// Path of the package in the fs.
Path string
// Files is a list of .proto files in the package.
Files Files
// GoImportName is the go package name of proto package.
GoImportName string
// Messages is a list of proto messages defined in the package.
Messages []Message
// Services is a list of RPC services.
Services []Service
}
Package represents a proto pkg.
func (Package) GoImportPath ¶
GoImportPath retrieves the Go import path.
type Packages ¶
type Packages []Package
type RPCFunc ¶
type RPCFunc struct {
// Name of the RPC func.
Name string
// RequestType is the request type of RPC func.
RequestType string
// ReturnsType is the response type of RPC func.
ReturnsType string
// HTTPRules keeps info about http rules of an RPC func.
// spec:
// https://github.com/googleapis/googleapis/blob/master/google/api/http.proto.
HTTPRules []HTTPRule
}
RPCFunc is an RPC func.
Click to show internal directories.
Click to hide internal directories.