2026-02-28 15:29:16 +08:00
|
|
|
package ctxdata
|
|
|
|
|
|
|
|
|
|
import "context"
|
|
|
|
|
|
|
|
|
|
func GetUserId(ctx context.Context) string {
|
|
|
|
|
if v, ok := ctx.Value("userId").(string); ok {
|
|
|
|
|
return v
|
|
|
|
|
}
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRoleKey(ctx context.Context) string {
|
|
|
|
|
if v, ok := ctx.Value("roleKey").(string); ok {
|
|
|
|
|
return v
|
|
|
|
|
}
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-30 02:53:55 +00:00
|
|
|
func GetTenantId(ctx context.Context) string {
|
|
|
|
|
if v, ok := ctx.Value("tenantId").(string); ok {
|
|
|
|
|
return v
|
|
|
|
|
}
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-28 15:29:16 +08:00
|
|
|
func GetPathId(ctx context.Context) string {
|
|
|
|
|
if v, ok := ctx.Value("pathId").(string); ok {
|
|
|
|
|
return v
|
|
|
|
|
}
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetPathKey(ctx context.Context) string {
|
|
|
|
|
if v, ok := ctx.Value("pathKey").(string); ok {
|
|
|
|
|
return v
|
|
|
|
|
}
|
|
|
|
|
return ""
|
|
|
|
|
}
|