Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSONRoutesDoc ¶
func JSONRoutesDoc(r chi.Routes) string
func MarkdownRoutesDoc ¶
func MarkdownRoutesDoc(r chi.Router, opts MarkdownOpts) string
func PrintRoutes ¶
func PrintRoutes(r chi.Routes)
Types ¶
type DocHandler ¶
type DocHandler struct { Middlewares []DocMiddleware `json:"middlewares"` Method string `json:"method"` FuncInfo }
type DocHandlers ¶
type DocHandlers map[string]DocHandler // Method : DocHandler
type DocMiddleware ¶
type DocMiddleware struct {
FuncInfo
}
type DocRoute ¶
type DocRoute struct { Pattern string `json:"-"` Handlers DocHandlers `json:"handlers,omitempty"` Router *DocRouter `json:"router,omitempty"` }
type DocRouter ¶
type DocRouter struct { Middlewares []DocMiddleware `json:"middlewares"` Routes DocRoutes `json:"routes"` }
type FuncInfo ¶
type FuncInfo struct { Pkg string `json:"pkg"` Func string `json:"func"` Comment string `json:"comment"` File string `json:"file,omitempty"` Line int `json:"line,omitempty"` Anonymous bool `json:"anonymous,omitempty"` Unresolvable bool `json:"unresolvable,omitempty"` }
func GetFuncInfo ¶
func GetFuncInfo(i interface{}) FuncInfo
type MarkdownDoc ¶
type MarkdownDoc struct { Opts MarkdownOpts Router chi.Router Doc Doc Routes map[string]DocRouter // Pattern : DocRouter // contains filtered or unexported fields }
func (*MarkdownDoc) Generate ¶
func (md *MarkdownDoc) Generate() error
func (*MarkdownDoc) String ¶
func (md *MarkdownDoc) String() string
func (*MarkdownDoc) WriteIntro ¶
func (md *MarkdownDoc) WriteIntro()
func (*MarkdownDoc) WriteRoutes ¶
func (md *MarkdownDoc) WriteRoutes()
type MarkdownOpts ¶
type MarkdownOpts struct { // ProjectPath is the base Go import path of the project ProjectPath string // Intro text included at the top of the generated markdown file. Intro string // ForceRelativeLinks to be relative even if they're not on github ForceRelativeLinks bool // URLMap allows specifying a map of package import paths to their link sources // Used for mapping vendored dependencies to their upstream sources // For example: // map[string]string{"github.com/my/package/vendor/go-chi/chi/": "https://github.com/go-chi/chi/blob/master/"} URLMap map[string]string }
Click to show internal directories.
Click to hide internal directories.