Documentation
¶
Index ¶
- Constants
- Variables
- func AppendController(c Controller)
- func Error(c *gin.Context, code int, err error, msg ...string)
- func GetRequestLogger(c *gin.Context) *logger.Helper
- func OK(c *gin.Context, data interface{}, msg ...string)
- func PageOK(c *gin.Context, result interface{}, count int64, pageIndex int64, ...)
- type Action
- type Api
- func (e *Api) AddError(err error) *Api
- func (e *Api) Bind(d interface{}, bindings ...binding.Binding) *Api
- func (*Api) Create(c *gin.Context)
- func (*Api) Delete(c *gin.Context)
- func (e *Api) Err(code int, msg ...string)
- func (*Api) Get(c *gin.Context)
- func (*Api) Handlers() []gin.HandlerFunc
- func (*Api) List(c *gin.Context)
- func (e *Api) Make(c *gin.Context) *Api
- func (e *Api) OK(data interface{}, msg ...string)
- func (*Api) Other(_ *gin.RouterGroup)
- func (e *Api) PageOK(result interface{}, count int64, pageIndex int64, pageSize int64, ...)
- func (*Api) Path() string
- func (e *Api) SetEngine(engine *gin.RouterGroup)
- func (*Api) Update(c *gin.Context)
- type Controller
- type Page
- type Response
- type Responses
- type Searcher
Constants ¶
View Source
const ( Get = "get" Base = "base" Delete = "delete" Search = "search" Control = "control" )
Variables ¶
View Source
var AuthHandler gin.HandlerFunc
View Source
var Controllers = make([]Controller, 0)
Controllers controllers
View Source
var DefaultLanguage = "zh-CN"
Functions ¶
func AppendController ¶
func AppendController(c Controller)
AppendController add controllers to Controllers
func GetRequestLogger ¶
GetRequestLogger 获取上下文提供的日志
Types ¶
type Action ¶ added in v0.0.9
type Action interface { fmt.Stringer Handler() gin.HandlerFunc }
Action interface
type Api ¶
type Api struct { Context *gin.Context Log *logger.Helper Error error // contains filtered or unexported fields }
func (*Api) Handlers ¶
func (*Api) Handlers() []gin.HandlerFunc
func (*Api) Other ¶
func (*Api) Other(_ *gin.RouterGroup)
func (*Api) PageOK ¶
func (e *Api) PageOK(result interface{}, count int64, pageIndex int64, pageSize int64, msg ...string)
PageOK 分页数据处理
func (*Api) SetEngine ¶
func (e *Api) SetEngine(engine *gin.RouterGroup)
type Controller ¶
type Controller interface { // Path http path Path() string // Handlers middlewares Handlers() gin.HandlersChain // GetAction get action GetAction(string) Action // Other handler Other(*gin.RouterGroup) // GetKey get key GetKey() string }
Controller controllers
Source Files
¶
Click to show internal directories.
Click to hide internal directories.