core

package
v0.0.0-...-29e02a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

* @Name: * @Descripttion: * @Warning: * @version: * @Author: moo * @Date: 2020-10-28 10:28:00 * @LastEditors: moo * @LastEditTime: 2020-11-02 13:52:22

* @Name: * @Descripttion: * @Warning: * @version: * @Author: moo * @Date: 2020-10-29 14:19:54 * @LastEditors: moo * @LastEditTime: 2021-05-17 18:49:29

* @Name: * @Descripttion: * @Warning: * @version: * @Author: moo * @Date: 2020-10-29 18:25:17 * @LastEditors: moo * @LastEditTime: 2021-01-29 22:48:04

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle(h HandlerFunc) gin.HandlerFunc

func SetDebug

func SetDebug(b bool)

func SetDefaultLogger

func SetDefaultLogger(logger *logcore.AppLogger)

func SetRespLogLevel

func SetRespLogLevel(level string)

Types

type Context

type Context struct {
	Ctx  *gin.Context
	Resp response
	// contains filtered or unexported fields
}

func NewContext

func NewContext(c *gin.Context, logs ...*logcore.AppLogger) *Context

func (*Context) CreateSuccess

func (cc *Context) CreateSuccess(args ...interface{})

func (*Context) Fail

func (cc *Context) Fail(code e.ERRCODE, args ...interface{})

func (*Context) Panic

func (cc *Context) Panic(code e.ERRCODE, args ...interface{})

需要写日志Panic level,返回客户端 500错误码

func (*Context) PrintPostJson

func (cc *Context) PrintPostJson()

func (*Context) RtnMsg

func (cc *Context) RtnMsg(status int, code e.ERRCODE, msg string)

func (*Context) Success

func (cc *Context) Success(args ...interface{})

type HandlerFunc

type HandlerFunc func(c *Context)

** Warning: HandlerFunc / Headle 的写法暂时废弃,原因是可能会影响gin的移植 **

type RspRecord

type RspRecord struct {
	UID    uint
	Status int
	Code   e.ERRCODE
	Msg    string
}

用于返回信息时设置在ctx中,向中间件传递数据

type SwagResp

type SwagResp struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL