middleware

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRolesFromContext

func GetRolesFromContext(ctx context.Context) []string

GetRolesFromContext 从上下文获取用户角色

func GetUsernameFromContext

func GetUsernameFromContext(ctx context.Context) string

GetUsernameFromContext 从上下文获取用户名

func RequirePermission

func RequirePermission(permission string) func(next http.HandlerFunc) http.HandlerFunc

RequirePermission 权限检查中间件

Types

type AuthMiddleware

type AuthMiddleware struct {
	// contains filtered or unexported fields
}

func NewAuthMiddleware

func NewAuthMiddleware(svcCtx *svc.ServiceContext) *AuthMiddleware

func (*AuthMiddleware) Handle

Handle 处理认证中间件

type DBHealth

type DBHealth struct {
	// contains filtered or unexported fields
}

DBHealth 数据库健康检查

func NewDBHealth

func NewDBHealth(svcCtx *svc.ServiceContext) *DBHealth

NewDBHealth 创建数据库健康检查实例

func (*DBHealth) Check

func (h *DBHealth) Check(ctx context.Context) error

Check 检查数据库连接

func (*DBHealth) Ping

func (h *DBHealth) Ping() error

Ping 简单的 ping 检查

Jump to

Keyboard shortcuts

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