docgen

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 15 Imported by: 185 modules, 175 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 Doc

type Doc struct {
	Router DocRouter `json:"router"`
}

func BuildDoc

func BuildDoc(r chi.Routes) (Doc, error)

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 DocRoutes

type DocRoutes map[string]DocRoute // Pattern : DocRoute

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 added in v1.0.1

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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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