2024-02-08 01:16:14 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
type UserInfoFields map[string]any
|
|
|
|
|
|
|
|
func (u UserInfoFields) GetString(key string) (string, bool) {
|
|
|
|
s, ok := u[key].(string)
|
|
|
|
return s, ok
|
|
|
|
}
|
|
|
|
|
|
|
|
func (u UserInfoFields) GetStringOrDefault(key, other string) string {
|
2024-02-10 11:59:45 +00:00
|
|
|
s, ok := u[key].(string)
|
2024-02-08 01:16:14 +00:00
|
|
|
if !ok {
|
|
|
|
s = other
|
|
|
|
}
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
2024-02-10 11:59:45 +00:00
|
|
|
func (u UserInfoFields) GetStringOrEmpty(key string) string {
|
|
|
|
s, _ := u[key].(string)
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
2024-02-08 01:16:14 +00:00
|
|
|
func (u UserInfoFields) GetBoolean(key string) (bool, bool) {
|
|
|
|
b, ok := u[key].(bool)
|
|
|
|
return b, ok
|
|
|
|
}
|