Documentation
¶
Index ¶
- Constants
- func CustomStatus(c *gin.Context, status, message string, data interface{})
- func Error(c *gin.Context, err error)
- func NewHttpServer(appName string, port int, router func(*gin.Engine), ...) server
- func Ok(c *gin.Context, data interface{})
- type Pagination
- type Paging
- type PagingResult
- type Response
Constants ¶
View Source
const ( WebApiPort = 80 HttpReadTimeout = 30 HttpWriteTimeout = 60 )
Variables ¶
This section is empty.
Functions ¶
func CustomStatus ¶
返回自定义 status, http 200
func NewHttpServer ¶
func NewHttpServer(appName string, port int, router func(*gin.Engine), stats func(*gin.Context, interface{}) error, throttle func() gin.HandlerFunc) server
* 创建HTTP API服务 * * param appName 服务命名,便于输出日志 * param port 侦听端口 * param router API路由注册回调函数 * param stats 预留 * param throttle 限流回调函数
Types ¶
type Pagination ¶
type PagingResult ¶
type PagingResult struct { List interface{} `json:"list,omitempty"` Pagination Pagination `json:"pagination,omitempty"` }
分页结构体
func NewPagingResult ¶
func NewPagingResult(current, pagesize int, total int64, list interface{}) PagingResult
分页数据结构体
Click to show internal directories.
Click to hide internal directories.