gin/router/api.go

36 lines
832 B
Go

// Package router ...
//
// Description : 便捷的相关API处理
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2021-03-26 2:06 下午
package router
import (
"github.com/gin-gonic/gin"
)
// IApi 每一个接口的实现约束
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2:08 下午 2021/3/26
type IApi interface {
// GetMethod 接口请求方法
GetMethod() string
// GetURI 接口URI
GetURI() string
// GetMiddleWareList 使用的中间件列表
GetMiddleWareList() []gin.HandlerFunc
// GetHandler 处理的handler
GetHandler() gin.HandlerFunc
}
// RouterFunc 注册路由的函数
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 3:09 下午 2021/3/26
type RouterFunc func() (method string, uri string, handlerFunc gin.HandlerFunc, middlewareList []gin.HandlerFunc)