Skip to content

Commit

Permalink
Merge pull request #32 from aliyun/feature/holo_registration
Browse files Browse the repository at this point in the history
feat: add datasource removal functions
  • Loading branch information
bruceding authored Sep 19, 2024
2 parents 2f720f6 + 5962721 commit d3c7b25
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions datasource/hologres/hologres.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
8 changes: 8 additions & 0 deletions datasource/tablestore/tablestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit d3c7b25

Please sign in to comment.