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 `json:"params,omitempty"` // HasQuery indicates if there is a request query. HasQuery bool `json:"has_query,omitempty"` // HasBody indicates if there is a request payload. HasBody bool `json:"has_body,omitempty"` }
HTTPRule keeps info about a configured http rule of an RPC func.
type Message ¶
type Message struct { // Name of the message. Name string `json:"name,omitempty"` // Path of the proto file where the message is defined. Path string `json:"path,omitempty"` // 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 `json:"highest_field_number,omitempty"` // Fields contains message's field names and types. Fields map[string]string `json:"fields,omitempty"` }
Message represents a proto message.
type Package ¶
type Package struct { // Name of the proto pkg. Name string `json:"name,omitempty"` // Path of the package in the fs. Path string `json:"path,omitempty"` // Files is a list of .proto files in the package. Files Files `json:"files,omitempty"` // GoImportName is the go package name of proto package. GoImportName string `json:"go_import_name,omitempty"` // Messages is a list of proto messages defined in the package. Messages []Message `json:"messages,omitempty"` // Services is a list of RPC services. Services []Service `json:"services,omitempty"` }
Package represents a proto pkg.
func (Package) GoImportPath ¶
GoImportPath retrieves the Go import path.
func (Package) MessageByName ¶
MessageByName finds a message by its name inside Package.
func (Package) ModuleName ¶
ModuleName retrieves the single module name of the package.
type Packages ¶
type Packages []Package
Packages represents slice of Package.
type RPCFunc ¶
type RPCFunc struct { // Name of the RPC func. Name string `json:"name,omitempty"` // RequestType is the request type of RPC func. RequestType string `json:"request_type,omitempty"` // ReturnsType is the response type of RPC func. ReturnsType string `json:"return_type,omitempty"` // HTTPRules keeps info about http rules of an RPC func. // spec: // https://github.com/googleapis/googleapis/blob/master/google/api/http.proto. HTTPRules []HTTPRule `json:"http_rules,omitempty"` // Paginated indicates that the RPC function is using pagination. Paginated bool `json:"paginated,omitempty"` }
RPCFunc is an RPC func.
Click to show internal directories.
Click to hide internal directories.