kos/entry/http/user.go

31 lines
511 B
Go
Raw Permalink Normal View History

2023-09-20 10:16:05 +08:00
package http
type Userinfo struct {
ID string
Name string
variables map[string]string
}
func (ui *Userinfo) Set(k, v string) {
if ui.variables == nil {
ui.variables = make(map[string]string)
}
ui.variables[k] = v
}
func (ui *Userinfo) Get(k string) string {
if ui.variables == nil {
return ""
}
return ui.variables[k]
}
2024-02-27 09:46:46 +08:00
func (ui *Userinfo) Reset(id, name string) {
ui.ID = id
ui.Name = name
// clear the variables
for k, _ := range ui.variables {
delete(ui.variables, k)
}
}