middleware

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(

	userService interfaces.UserService,
	cfg *config.Config,
) gin.HandlerFunc

Auth 认证中间件

func ErrorHandler

func ErrorHandler() gin.HandlerFunc

ErrorHandler 是一个处理应用错误的中间件

func GetTenantIDFromContext

func GetTenantIDFromContext(ctx context.Context) (uint64, error)

GetTenantIDFromContext helper function to get tenant ID from context

func Logger

func Logger() gin.HandlerFunc

Logger middleware logs request details with request ID, input and output

func Recovery

func Recovery() gin.HandlerFunc

Recovery is a middleware that recovers from panics

func RequestID

func RequestID() gin.HandlerFunc

RequestID middleware adds a unique request ID to the context

func SetBypassUserProvider added in v0.2.1

func SetBypassUserProvider(provider func() *types.User)

SetBypassUserProvider 关闭认证校验,所有请求都以 provider 返回的用户身份执行。 必须在校由构建前调用(即 appsrv.New 之前);传 nil 恢复认证。 provider 延迟调用,因此可在容器就绪后初始化/落库用户。

Types

This section is empty.

Jump to

Keyboard shortcuts

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