22 lines
269 B
Go
22 lines
269 B
Go
package common
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/nose7en/ToyBoomServer/defs"
|
|
)
|
|
|
|
func GetUser(c context.Context) defs.UserGettable {
|
|
val := c.Value(UserInfoKey)
|
|
if val == nil {
|
|
return nil
|
|
}
|
|
|
|
u, ok := val.(defs.UserGettable)
|
|
if !ok {
|
|
return nil
|
|
}
|
|
|
|
return u
|
|
}
|