package starmap import ( "errors" ) type StarMap interface { GetName() string } type StarMapSample struct{} func (sample StarMapSample) GetName() string { return "starsample" } func GetMap(value StarMap) error { kvmuPro.RLock() defer kvmuPro.RUnlock() value, ok := kvMapPro[value.GetName()] if !ok { return errors.New("key not exists") } return nil } func StoreMap(value StarMap) error { kvmuPro.Lock() defer kvmuPro.Unlock() kvMapPro[value.GetName()] = value return nil } func DeleteMap(value StarMap) error { delete(kvMapPro, value.GetName()) return nil }