diff --git a/datasource/hologres/hologres.go b/datasource/hologres/hologres.go index eaef419..9e031e3 100644 --- a/datasource/hologres/hologres.go +++ b/datasource/hologres/hologres.go @@ -77,3 +77,16 @@ func RegisterHologres(name, dsn string) { hologresInstances[name] = m } + +func RemoveHologres(name string) { + hologres, ok := hologresInstances[name] + if !ok { + return + } + + if hologres.DB != nil { + hologres.DB.Close() + } + + delete(hologresInstances, name) +} diff --git a/datasource/tablestore/tablestore.go b/datasource/tablestore/tablestore.go index 9872744..4f6b7b4 100644 --- a/datasource/tablestore/tablestore.go +++ b/datasource/tablestore/tablestore.go @@ -35,6 +35,14 @@ func GetTableStoreClient(name string) (*TableStoreClient, error) { return tablestoreInstances[name], nil } +func DeleteTableStoreClient(name string) { + if _, ok := tablestoreInstances[name]; !ok { + return + } + + delete(tablestoreInstances, name) +} + func (o *TableStoreClient) GetClient() *tablestore.TableStoreClient { return o.client }