32 lines
522 B
Go
32 lines
522 B
Go
|
|
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 ""
|
||
|
|
}
|
||
|
|
|
||
|
|
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 ""
|
||
|
|
}
|