Kepler core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
444 B

package restlet
import "sync"
type Dictionary struct {
data map[string]interface{}
mutex sync.Mutex
}
func (d *Dictionary) Set(k string, v interface{}) error {
d.mutex.Lock()
defer d.mutex.Unlock()
if d.data == nil {
d.data = make(map[string]interface{})
}
d.data[k] = v
return nil
}
func (d Dictionary) Get(k string) (interface{}, bool) {
if d.data == nil {
return nil, false
} else {
v, b := d.data[k]
return v, b
}
}