mirror of
https://github.com/1f349/lavender.git
synced 2024-12-22 23:54:10 +00:00
27 lines
495 B
Go
27 lines
495 B
Go
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 {
|
|
s, ok := u[key].(string)
|
|
if !ok {
|
|
s = other
|
|
}
|
|
return s
|
|
}
|
|
|
|
func (u UserInfoFields) GetStringOrEmpty(key string) string {
|
|
s, _ := u[key].(string)
|
|
return s
|
|
}
|
|
|
|
func (u UserInfoFields) GetBoolean(key string) (bool, bool) {
|
|
b, ok := u[key].(bool)
|
|
return b, ok
|
|
}
|