tik

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGenOne

func AddGenOne(handleFuncName, routerPath string, methods []string)

添加路由 参数<handleFuncName>是路由处理函数的名称 <routerPath>是具体的路由 url 路径 <methods>是具体的请求方法

func FindTag

func FindTag(obj interface{}, field, tag string) string

FindTag find struct of tag string.查找struct 的tag信息

func GetStringList

func GetStringList(list []string) string

GetStringList format string

func UnMarshal

func UnMarshal(name string) string

UnMarshal 回退网络模式

Types

type APIFunc

type APIFunc func(*gin.Context) interface{}

type Base

type Base struct {
	// contains filtered or unexported fields
}

func Annotation

func Annotation() *Base

func (*Base) BasePath

func (b *Base) BasePath(router gin.IRoute) string

返回当前路由的绝对URL

func (*Base) Model

func (b *Base) Model(middleware APIFunc) *Base

Model use custom context

func (*Base) Register

func (b *Base) Register(router gin.IRoute, list []interface{}) bool

注册gin注解路由

func (*Base) SetDev

func (b *Base) SetDev(isDev bool)

func (*Base) SetOutDoc

func (b *Base) SetOutDoc(outDoc bool)

type BeforeAfter

type BeforeAfter struct {
	C        *gin.Context
	FuncName string      // 函数名
	Param    interface{} // 调用前的请求参数
	Response interface{} // 调用后的返回数据
	Error    error
	Ctx      context.Context // 占位参数,可用于存储其他参数,前后连接可用
}

对象调用前后执行中间件参数

type DefaultBeforeAfter

type DefaultBeforeAfter struct{}

func (*DefaultBeforeAfter) After

func (d *DefaultBeforeAfter) After(r *BeforeAfter) bool

call之后调用

func (*DefaultBeforeAfter) Before

func (d *DefaultBeforeAfter) Before(r *BeforeAfter) bool

call之前调用

type ErrorFunc

type ErrorFunc func(interface{}) //错误设置

type Hook

type Hook interface {
	Before(r *BeforeAfter) bool
	After(r *BeforeAfter) bool
}

对象调用前后执行中间件(支持总的跟对象单独添加)

type RespBody

type RespBody struct {
	State bool        `json:"state"`
	Code  int         `json:"code,omitempty"`
	Error string      `json:"error,omitempty"`
	Data  interface{} `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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