kos/entry/http/user.go

31 lines
511 B
Go

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]
}
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)
}
}