docgen

package module
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2018 License: MIT Imports: 14 Imported by: 0

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