xmiddleware

package
v0.0.0-...-663b367 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthHeaderKey   = "Authorization"
	AuthUserIdKey   = "user_id"
	AuthUsernameKey = "username"
)
View Source
const (
	// RequestIDKey 请求ID的键名
	RequestIDKey = "request_id"
	// RequestIDHeader 请求ID的请求头
	RequestIDHeader = "X-Request-ID"
)

Variables

This section is empty.

Functions

func Auth

func Auth(claim xoauth.Claim) gin.HandlerFunc

Auth 认证中间件

func Cors

func Cors() gin.HandlerFunc

Cors 跨域中间件

func GetCurrentUser

func GetCurrentUser(c *gin.Context) (string, string, bool)

GetCurrentUser 从上下文中获取当前用户信息

func Logger

func Logger(logger *xlog.Logger, debug bool) gin.HandlerFunc

Logger 日志中间件

func OptionalAuth

func OptionalAuth(claim xoauth.Claim) gin.HandlerFunc

OptionalAuth 可选的认证中间件

func RequestID

func RequestID() gin.HandlerFunc

RequestID 请求ID中间件

func TimeFormat

func TimeFormat(ctx *gin.Context)

func TracingMiddleware

func TracingMiddleware(tracer opentracing.Tracer) gin.HandlerFunc

TracingMiddleware 链路追踪中间件

Types

This section is empty.

Jump to

Keyboard shortcuts

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