middleware

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminAuthorizator

func AdminAuthorizator(data interface{}, c *gin.Context) bool

role is admin can access

func AllUserAuthorizator

func AllUserAuthorizator(data interface{}, c *gin.Context) bool

func Common

func Common(c *gin.Context)

func CorsHandler

func CorsHandler() gin.HandlerFunc

func GenLogId

func GenLogId() string

依据时间戳产生logid,该logid方便后续根据真实时间戳分类存储图文日志

func GinJWTMiddlewareInit

func GinJWTMiddlewareInit(jwtAuthorizator JwtAuthorizator) (authMiddleware *jwt.GinJWTMiddleware)

func LoggerM

func LoggerM(opt LoggerOptions) gin.HandlerFunc

Logger is a middleware which provide a logger in ctx. Records each handling on os.stdout. nolint:funlen

func Milliseconds

func Milliseconds(t time.Duration) float64

func NoRouteHandler

func NoRouteHandler(c *gin.Context)

404 handler

func TestAuthorizator

func TestAuthorizator(data interface{}, c *gin.Context) bool

username is test can access

Types

type F

type F logrus.Fields

type JwtAuthorizator

type JwtAuthorizator func(data interface{}, c *gin.Context) bool

type Logger

type Logger struct {
	*logrus.Logger
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger() *Logger

NewLogger returns logrus instance

func (*Logger) Write

func (log *Logger) Write(msg string, fd interface{})

Write writes content info logger Fields

type LoggerOptions

type LoggerOptions struct {
	Application  string
	Version      string
	EnableOutput bool
	Debug        string
}

Jump to

Keyboard shortcuts

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