comment_parser

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	//@CORS
	CORS bool
	//@DEPRECATED
	Deprecated bool //deprecate a method
	HasReq     bool //if a method has request type defined(the second param)
	//@REQ model.RequestType
	RequestType []string // //specify the request type of current method. method's request type has higher priority.
	HasResp     bool     //if a method has result type defined
	//@RESP model.ResponseType
	ResultType []string //specify the result type of current method. method's result type has higher priority.
	//@DESC
	Description []string
	//Name Summary.
	Summary string // if empty, this field will be the Name of it
	//@GET /api/v1/user/list.
	Routes map[string]string // will like map[route]HttpMethod
	//@Anonymous
	Anonymous bool // current method will be anonymous even if `@AUTH` had been set to the controller. not implemented yet.
	//@ROUTE /api/v1.
	Route string // route prefix of current controller
	//@TAG tagname.
	Tag string // will show on Swagger UI as tag
	//@AUTH Authorization.
	AuthorizationHeader string //add a required header parameter to all methods under current controller.
}

func (*Comment) GetDescription

func (c *Comment) GetDescription(sep string) string

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser(name string, comments []string) *Parser

NewParser returns a new comment parser instance for parsing struct

@param name struct name
@param comments struct docs

@return *Parser

func (*Parser) Parse

func (p *Parser) Parse(groupRoute string) *Comment

Parse will parse the struct and return Comment type

@param groupRoute route prefix

@return *Comment

Jump to

Keyboard shortcuts

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