Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

docgen

v2.0.0+incompatible
github.com/djui/chi/docgen

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

20 matches

Top ↑

Functions

JSONRoutesDoc

func JSONRoutesDoc(r chi.Routes) string

MarkdownRoutesDoc

func MarkdownRoutesDoc(r chi.Router, opts MarkdownOpts) string

PrintRoutes

func PrintRoutes(r chi.Routes)

Types

Doc

type Doc struct {
	// TODO: should we take some kind of package name?
	// or the base pkg path...?
	// ^ we could confirm it..
	Router DocRouter `json:"router"`
}

BuildDoc

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

DocHandler

type DocHandler struct {
	Middlewares []DocMiddleware `json:"middlewares"`
	Method      string          `json:"method"`
	FuncInfo
}

DocHandlers

type DocHandlers map[string]DocHandler // Method : DocHandler

DocMiddleware

type DocMiddleware struct {
	FuncInfo
}

DocRoute

type DocRoute struct {
	Pattern  string      `json:"-"`
	Handlers DocHandlers `json:"handlers,omitempty"`
	Router   *DocRouter  `json:"router,omitempty"`
}

DocRouter

type DocRouter struct {
	Middlewares []DocMiddleware `json:"middlewares"`
	Routes      DocRoutes       `json:"routes"`
}

DocRoutes

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

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"`
}

MarkdownDoc

type MarkdownDoc struct {
	Opts   MarkdownOpts
	Router chi.Router
	Doc    Doc
	Routes map[string]DocRouter // Pattern : DocRouter
	// contains filtered or unexported fields
}

MarkdownDoc.Generate

func (md *MarkdownDoc) Generate() error

MarkdownDoc.String

func (md *MarkdownDoc) String() string

MarkdownDoc.WriteIntro

func (md *MarkdownDoc) WriteIntro()

MarkdownDoc.WriteRoutes

func (md *MarkdownDoc) WriteRoutes()

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/pressly/chi/": "https://github.com/pressly/chi/blob/master/"}
	URLMap map[string]string
}

Dependency graph