handler

package
v0.0.0-...-2189692 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(handler http.HandlerFunc) gin.HandlerFunc

func Converts

func Converts(handlers []http.HandlerFunc) []gin.HandlerFunc

func FromStdWithNext

func FromStdWithNext(h func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)) gin.HandlerFunc

func Res

func Res(c *gin.Context, code errorcode.ErrCode, msg string, data interface{})

func Response

func Response(ctx *gin.Context, res ...interface{})

先信息后数据最后状态码 入参1. data interface{},msg string,code int 2.msg,code |data默认nil 3.data,msg |code默认SUCCESS 4.msg |data默认nil code默认ERROR 5.data |msg默认"",code默认SUCCESS

func Wrap

func Wrap(handler interface{}) gin.HandlerFunc

Wrap converts native http.Handler & http.HandlerFunc to gin.HandlerFunc.

Supported form types:

.Wrap(h http.Handler)
.Wrap(func(w http.ResponseWriter, r *http.Request))
.Wrap(func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc))

Types

type ExportService

type ExportService struct{}

type File

type File struct {
	File http.File
	Name string
}

type H

type H map[string]interface{}

type HttpFile

type HttpFile interface {
	io.Reader
	Name() string
}

type ResData

type ResData struct {
	Code    errorcode.ErrCode `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string            `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	//验证码
	Details interface{} `protobuf:"bytes,3,opt,name=details,proto3" json:"details,omitempty"`
}

Jump to

Keyboard shortcuts

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