Documentation ¶
Index ¶
- Variables
- func CheckPageParam(c *Context) (bool, error)
- func CheckToken(token, apiPath string, c *Context) (string, error)
- func GetAnyString(desc string, keys ...interface{}) string
- func GetJoinString(ss ...interface{}) string
- func GetKeyword(keys ...interface{}) string
- func GetStatus(s interface{}) string
- func GetString(s interface{}) string
- func HandleFunc(handler func(c *Context)) func(ctx *gin.Context)
- func InitLog(logDir, logfileName string)
- func InitLogger(l *Log) zapcore.Core
- func LogDebug(msg ...string)
- func LogError(msg ...string)
- func LogFatal(msg ...string)
- func LogInfo(msg ...string)
- func LogPanic(msg ...string)
- func LogWarn(msg ...string)
- func SendResponse(c *Context, err error, data interface{})
- type BodyLogWriter
- type Context
- func (c *Context) ArgsBool(key string) bool
- func (c *Context) ArgsBoolDefault(key string, val bool) bool
- func (c *Context) ArgsFile(key string) (*multipart.FileHeader, error)
- func (c *Context) ArgsFileDefault(key string, file *multipart.FileHeader) (*multipart.FileHeader, error)
- func (c *Context) ArgsFloat64(key string) float64
- func (c *Context) ArgsFloat64Array(key string) []float64
- func (c *Context) ArgsFloat64ArrayDefault(key string, val []float64) []float64
- func (c *Context) ArgsFloat64Default(key string, val float64) float64
- func (c *Context) ArgsInt(key string) int
- func (c *Context) ArgsInt64(key string) int64
- func (c *Context) ArgsInt64Array(key string) []int64
- func (c *Context) ArgsInt64ArrayDefault(key string, val []int64) []int64
- func (c *Context) ArgsInt64Default(key string, val int64) int64
- func (c *Context) ArgsIntArray(key string) []int
- func (c *Context) ArgsIntArrayDefault(key string, val []int) []int
- func (c *Context) ArgsIntDefault(key string, val int) int
- func (c *Context) ArgsObject(key string) interface{}
- func (c *Context) ArgsObjectDefault(key string, val interface{}) interface{}
- func (c *Context) ArgsString(key string) string
- func (c *Context) ArgsStringArray(key string) []string
- func (c *Context) ArgsStringArrayDefault(key string, val []string) []string
- func (c *Context) ArgsStringDefault(key string, val string) string
- func (c *Context) ArgsUint(key string) uint
- func (c *Context) ArgsUint64(key string) uint64
- func (c *Context) ArgsUint64Array(key string) []uint64
- func (c *Context) ArgsUint64ArrayDefault(key string, val []uint64) []uint64
- func (c *Context) ArgsUint64Default(key string, val uint64) uint64
- func (c *Context) ArgsUintArray(key string) []uint
- func (c *Context) ArgsUintArrayDefault(key string, val []uint) []uint
- func (c *Context) ArgsUintDefault(key string, val uint) uint
- func (c *Context) SaveFile(key, savePath string) error
- type Err
- type Errno
- type H
- type HandlerFunc
- type Log
- type LogData
- type Response
- type RouterGroup
- func (r *RouterGroup) ANY(relativePath string, handlers ...func(c *Context)) gin.IRoutes
- func (r *RouterGroup) DELETE(relativePath string, handlers ...func(c *Context)) gin.IRoutes
- func (r *RouterGroup) GET(relativePath string, handlers ...func(c *Context)) gin.IRoutes
- func (r *RouterGroup) POST(relativePath string, handlers ...func(c *Context)) gin.IRoutes
- func (r *RouterGroup) PUT(relativePath string, handlers ...func(c *Context)) gin.IRoutes
- func (r *RouterGroup) Use(middlewares ...func(c *Context)) gin.IRoutes
- type Server
- func (s *Server) ANY(relativePath string, handlers ...func(c *Context)) gin.IRoutes
- func (s *Server) DELETE(relativePath string, handlers ...func(c *Context)) gin.IRoutes
- func (s *Server) GET(relativePath string, handlers ...func(c *Context)) gin.IRoutes
- func (s *Server) Group(relativePath string, handlers ...func(c *Context)) *RouterGroup
- func (s *Server) NoRoute(handlers ...func(c *Context))
- func (s *Server) POST(relativePath string, handlers ...func(c *Context)) gin.IRoutes
- func (s *Server) PUT(relativePath string, handlers ...func(c *Context)) gin.IRoutes
- func (s *Server) Use(middlewares ...HandlerFunc)
- type ThirdResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( OK = &Errno{Code: 0, Message: "success", Tips: "成功"} InternalError = &Errno{Code: 10001, Message: "Internal server error", Tips: "服务器内部错误"} ErrTokenInvalid = &Errno{Code: 20001, Message: "The token was invalid", Tips: "Token无效"} ErrParam = &Errno{Code: 30001, Message: "The parameter is error", Tips: "参数错误"} ErrPageParam = &Errno{Code: 30002, Message: "The parameter of page_no or page_size is error", Tips: "分页参数错误"} )
View Source
var JwtSecret = "ABCDEFabcdef123456"
Functions ¶
func CheckPageParam ¶
func GetAnyString ¶
func GetJoinString ¶
func GetJoinString(ss ...interface{}) string
func GetKeyword ¶
func GetKeyword(keys ...interface{}) string
func HandleFunc ¶
func InitLogger ¶
func SendResponse ¶
Types ¶
type BodyLogWriter ¶
type BodyLogWriter struct { gin.ResponseWriter // contains filtered or unexported fields }
type Context ¶
func (*Context) ArgsFileDefault ¶
func (c *Context) ArgsFileDefault(key string, file *multipart.FileHeader) (*multipart.FileHeader, error)
func (*Context) ArgsFloat64 ¶
func (*Context) ArgsFloat64Array ¶
func (*Context) ArgsFloat64ArrayDefault ¶
func (*Context) ArgsFloat64Default ¶
func (*Context) ArgsInt64Array ¶
func (*Context) ArgsInt64ArrayDefault ¶
func (*Context) ArgsIntArray ¶
func (*Context) ArgsIntArrayDefault ¶
func (*Context) ArgsObject ¶
func (*Context) ArgsObjectDefault ¶
func (*Context) ArgsString ¶
func (*Context) ArgsStringArray ¶
func (*Context) ArgsStringArrayDefault ¶
func (*Context) ArgsStringDefault ¶
func (*Context) ArgsUint64 ¶
func (*Context) ArgsUint64Array ¶
func (*Context) ArgsUint64ArrayDefault ¶
func (*Context) ArgsUint64Default ¶
func (*Context) ArgsUintArray ¶
func (*Context) ArgsUintArrayDefault ¶
type Errno ¶
type HandlerFunc ¶
type HandlerFunc func(*Context)
func Cors ¶
func Cors() HandlerFunc
func LogAop ¶
func LogAop(dealLogInfo func(data LogData)) HandlerFunc
type RouterGroup ¶
type RouterGroup struct {
*gin.RouterGroup
}
func (*RouterGroup) ANY ¶
func (r *RouterGroup) ANY(relativePath string, handlers ...func(c *Context)) gin.IRoutes
func (*RouterGroup) DELETE ¶
func (r *RouterGroup) DELETE(relativePath string, handlers ...func(c *Context)) gin.IRoutes
func (*RouterGroup) GET ¶
func (r *RouterGroup) GET(relativePath string, handlers ...func(c *Context)) gin.IRoutes
func (*RouterGroup) POST ¶
func (r *RouterGroup) POST(relativePath string, handlers ...func(c *Context)) gin.IRoutes
type Server ¶
func DefaultServer ¶
func (*Server) Group ¶
func (s *Server) Group(relativePath string, handlers ...func(c *Context)) *RouterGroup
func (*Server) Use ¶
func (s *Server) Use(middlewares ...HandlerFunc)
type ThirdResponse ¶
Click to show internal directories.
Click to hide internal directories.