doc

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DocModel

type DocModel struct {
	RouterPath   string
	Methods      []string
	Summary      string
	Description  string
	Req, Resp    *StructInfo
	TokenHeader  string
	IsDeprecated bool
}

DocModel Model

type ElementInfo

type ElementInfo struct {
	Name      string      // 参数名
	Tag       string      // 标签
	Type      string      // 类型
	TypeRef   *StructInfo // 类型定义
	IsArray   bool        // 是否是数组
	IsTDArray bool        // 是否二维数组

	Required  bool   // 是否必须
	Note      string // 注释
	Default   string // 默认值
	ParamType ParamType

	IsQuery    bool // 是否是query
	IsHeader   bool // 是否是header
	IsFormData bool // 是否是表单参数
	IsFile     bool
	IsPath     bool // 是否是路径参数
}

ElementInfo 结构信息

type Model

type Model struct {
	Group          string // group 标记
	TagControllers map[string]map[string]DocModel
}

func NewDoc

func NewDoc(group string) *Model

NewDoc 新建一个doc模板 一次Register产生一个

func (*Model) AddOne

func (m *Model) AddOne(group string, routerPath string, methods []string, summary string, description string, req, resp *StructInfo, tokenHeader string, isDeprecated bool)

AddOne 添加一个方法

type ParamType

type ParamType int
const (
	ParamTypeQuery ParamType = iota
	ParamTypeHeader
	ParamTypeForm
	ParamTypePath
)

type StructInfo

type StructInfo struct {
	Items   []*ElementInfo // 结构体元素
	IsArray bool
	File    string
	Note    string // 注释
	Name    string // 结构体名字
	Pkg     string // 包名
}

StructInfo struct define

Jump to

Keyboard shortcuts

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