// RegisterAdapter registers a generic database adapter.
func RegisterAdapter(name string, adapter Adapter) {
adapterMapMu.Lock()
defer adapterMapMu.Unlock()
if name == "" {
panic(`Missing adapter name`)
}
if _, ok := adapterMap[name]; ok {
panic(`db.RegisterAdapter() called twice for adapter: ` + name)
}
adapterMap[name] = adapter
}
adapterMap var,this way of adapterMap is problematic
In business scenarios, different mysql db instances will be used. If there is a mysql name here, panic will occur if you look at the code here. I think this is unreasonable. Can you improve it?
https://github.com/upper/db/blob/6d34eff2084ed3b148d5d7df13630a122180d347/adapter.go#L55
adapterMap var,this way of adapterMap is problematic In business scenarios, different mysql db instances will be used. If there is a mysql name here, panic will occur if you look at the code here. I think this is unreasonable. Can you improve it?