Documentation ¶
Index ¶
- Constants
- Variables
- func BaseStart(ctx context.Context, engine *gin.Engine, port string, logger *logger.ZapX)
- func GoMicroServer(ctx context.Context, engine *gin.Engine, servername, port string, ...) error
- func RegisterGroup(engine *gin.Engine, group *RouterGroup)
- func RegisterGroupSimple(engine *gin.Engine, Relative string, Middlewares []gin.HandlerFunc, ...)
- func RegisterHandler(engine *gin.Engine, handlers ...RouterHandler)
- func Start(engine *gin.Engine, port string, logger *logger.ZapX)
- type Handler
- type ResponseCode
- type RouterGroup
- type RouterHandler
Constants ¶
View Source
const ( Nil reqType = iota JSON XML Form Query FormPost FormMultipart ProtoBuf MsgPack YAML Uri Header TOML )
Variables ¶
View Source
var ( ErrNotFound = errors.New("no this record") ErrInsert = errors.New("insert fail") ErrUpdate = errors.New("update fail") ErrDelete = errors.New("delete fail") )
各类错误类型
View Source
var DefaultQPS = 100
Functions ¶
func GoMicroServer ¶
func GoMicroServer(ctx context.Context, engine *gin.Engine, servername, port string, logger *logger.ZapX) error
uber: 漏桶限流实现 limiter: 令牌桶限流实现 hystrix: 熔断器实现
func RegisterGroup ¶
func RegisterGroup(engine *gin.Engine, group *RouterGroup)
func RegisterGroupSimple ¶
func RegisterGroupSimple(engine *gin.Engine, Relative string, Middlewares []gin.HandlerFunc, Handlers []RouterHandler)
func RegisterHandler ¶
func RegisterHandler(engine *gin.Engine, handlers ...RouterHandler)
Types ¶
type ResponseCode ¶
type ResponseCode uint32
const ( ServerOK ResponseCode = iota ServerError )
运行状态
const ( // 参数问题 ParamEmpty ResponseCode = 101 + iota ParamInvalid )
func (ResponseCode) String ¶
func (c ResponseCode) String() string
type RouterGroup ¶
type RouterGroup struct { Relative string Middlewares []gin.HandlerFunc Handler []RouterHandler }
type RouterHandler ¶
type RouterHandler struct { Method string Url string Handler gin.HandlerFunc Middleware []gin.HandlerFunc }
func H ¶
func H(method string, url string, handler gin.HandlerFunc, middleware []gin.HandlerFunc) RouterHandler
Click to show internal directories.
Click to hide internal directories.