app

package
v0.0.0-...-f52182f Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2019 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const GETUSERINFO string = "TokenUserInfo"

Variables

This section is empty.

Functions

func Any

func Any(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

Any registers a route that matches all the HTTP methods. GET, POST, PUT, PATCH, HEAD, OPTIONS, DELETE, CONNECT, TRACE.

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

跨域中间件

func DELETE

func DELETE(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

DELETE is a shortcut for router.Handle("DELETE", path, handle).

func ErrorLogger

func ErrorLogger() gin.HandlerFunc

func ErrorLoggerT

func ErrorLoggerT(typ gin.ErrorType) gin.HandlerFunc

func GET

func GET(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

GET is a shortcut for router.Handle("GET", path, handle).

func GetUserId

func GetUserId(c *gin.Context) int64

获取登录用户信息

func GetUserInfo

func GetUserInfo(c *gin.Context) map[string]interface{}

func GetUserProp

func GetUserProp(c *gin.Context, key string) (value interface{}, exists bool)
func HEAD(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

HEAD is a shortcut for router.Handle("HEAD", path, handle).

func Handle

func Handle(httpMethod, relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

Handle registers a new request handle and middleware with the given path and method. The last handler should be the real handler, the other ones should be middleware that can and should be shared among different routes. See the example code in github.

For GET, POST, PUT, PATCH and DELETE requests the respective shortcut functions can be used.

This function is intended for bulk loading and to allow the usage of less frequently used, non-standardized or custom methods (e.g. for internal communication with a proxy).

func IsSuper

func IsSuper(c *gin.Context) bool

当前账号是否超级管理员

func Logger

func Logger(duration time.Duration) gin.HandlerFunc

func OPTIONS

func OPTIONS(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

OPTIONS is a shortcut for router.Handle("OPTIONS", path, handle).

func PATCH

func PATCH(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

PATCH is a shortcut for router.Handle("PATCH", path, handle).

func POST

func POST(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

POST is a shortcut for router.Handle("POST", path, handle).

func PUT

func PUT(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

PUT is a shortcut for router.Handle("PUT", path, handle).

func Run

func Run(addr ...string)

func Static

func Static(relativePath, root string) gin.IRoutes

func StaticFS

func StaticFS(relativePath string, fs http.FileSystem) gin.IRoutes

func StaticFile

func StaticFile(relativePath, filepath string) gin.IRoutes

StaticFile registers a single route in order to serve a single file of the local filesystem. router.StaticFile("favicon.ico", "./resources/favicon.ico")

func TokenErrorAbort

func TokenErrorAbort(c *gin.Context, code string, message string)

func TokenMiddleware

func TokenMiddleware() gin.HandlerFunc

Token中间件

func Use

func Use(middleware ...gin.HandlerFunc) gin.IRoutes

Types

This section is empty.

Jump to

Keyboard shortcuts

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