Documentation
¶
Index ¶
- Constants
- func TypeParts(selector string) (string, string)
- type Array
- type Field
- type File
- type Function
- func (f Function) FindArgTypeCallExpression(callCriteria criteria.CallCriteria) (string, error)
- func (f Function) FindErrorResponseCallExpressionAfter(callCriteria criteria.CallCriteria, pos *token.Pos, ...) error
- func (f Function) FindResponseCallExpressionAfter(callCriteria criteria.CallCriteria, pos *token.Pos, ...) error
- func (f Function) ListVariablesUntil(until token.Pos) []Variable
- type Import
- type ModelResponse
- type Pkg
- type Project
- type Route
- type ServiceResponse
- type Struct
- type Variable
Constants ¶
const ( // ImportKeyWord is the keyword "import" ImportKeyWord string = "import" // VarKeyWord is the keyword "var" VarKeyWord string = "var" // ConstKeyWord is the keyword "const" ConstKeyWord string = "const" // TypeKeyWord is the keyword "type" TypeKeyWord string = "type" // EmptyInterface is the empty interface keyword EmptyInterface = "interface{}" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type File ¶
type File struct {
Pkg *Pkg
Name string
FSet *token.FileSet
File *ast.File
Structs []Struct
Imports []Import
GlobalVars []Variable
GlobalConst []Variable
Functions []Function
// contains filtered or unexported fields
}
File is a go file
func (*File) FindStruct ¶
FindStruct find a struct in a file
func (*File) SearchForStructRoutes ¶
func (file *File) SearchForStructRoutes(structRoute criteria.StructRoute) []Route
SearchForStructRoutes searches for struct routes inside a file
type Function ¶
type Function struct {
File *File
Name string
MemberOf string
Args []Variable
Return []string
// contains filtered or unexported fields
}
Function is a function in a package
func (Function) FindArgTypeCallExpression ¶
func (f Function) FindArgTypeCallExpression(callCriteria criteria.CallCriteria) (string, error)
FindArgTypeCallExpression given a call expression it finds the type of the argument
func (Function) FindErrorResponseCallExpressionAfter ¶
func (f Function) FindErrorResponseCallExpressionAfter(callCriteria criteria.CallCriteria, pos *token.Pos, modelResponse *ModelResponse) error
FindErrorResponseCallExpressionAfter given a call expression it finds the type of the argument past a position
func (Function) FindResponseCallExpressionAfter ¶
func (f Function) FindResponseCallExpressionAfter(callCriteria criteria.CallCriteria, pos *token.Pos, modelResponse *ModelResponse) error
FindResponseCallExpressionAfter given a call expression it finds the type of the argument past a position
type ModelResponse ¶
ModelResponse is a response model
type Pkg ¶
type Pkg struct {
Project *Project
Name string
Path string
Files []File
Logger *log.Logger
BlackList []*regexp.Regexp
}
Pkg is a package
func AnalizeProject ¶
AnalizeProject reads a project and returns a list of packages
func AnalizeProjectWithBlacklist ¶
func AnalizeProjectWithBlacklist(path string, logger *log.Logger, blacklist []*regexp.Regexp) ([]*Pkg, error)
AnalizeProjectWithBlacklist reads a project excluding some files and returns a list of packages
func NewPkgWithoutTest ¶
NewPkgWithoutTest creates a new package with the default blacklist
func (*Pkg) FindStruct ¶
FindStruct find a struct in a package
func (*Pkg) SearchForStructRoutes ¶
func (p *Pkg) SearchForStructRoutes(structRoute criteria.StructRoute) []Route
SearchForStructRoutes searches for struct routes
type Project ¶
Project is a golang project
func (*Project) FindStruct ¶
FindStruct find a struct in a package
func (*Project) SearchForStructRoutes ¶
func (p *Project) SearchForStructRoutes(structRoute criteria.StructRoute) []Route
SearchForStructRoutes searches for struct routes
type Route ¶
type Route struct {
Pkg string
File string
Path string
HTTPMethod string
HandlerType string
NamedPathVarExtractor *regexp.Regexp
ChildRoutes []*Route
Middlewares []string
RequestModel Struct
ServiceResponses []ServiceResponse
Struct map[string]string
MatchedParameters map[string]bool
MatchedSecurityDefinitions map[string]bool
}
Route is web route found in the folder
type ServiceResponse ¶
type ServiceResponse struct {
Code string
ModelExtractor criteria.ModelExtractor
Model Struct
}
ServiceResponse is the response from a service
type Struct ¶
type Struct struct {
File *File
PkgName string
Name string
Fields []Field
CallCriteria criteria.CallCriteria
Schema *openapi3.Schema
}
Struct is a struct
func (*Struct) ToSwaggerSchema ¶
ToSwaggerSchema populates a given swagger schema with the data from the struct