Skip to content

Commit

Permalink
fix /api/db/drop 不存在的数据库删除错误提示
Browse files Browse the repository at this point in the history
  • Loading branch information
ep1088 committed Aug 4, 2022
1 parent 7d725c5 commit 801f149
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions searcher/container.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package searcher

import (
"errors"
"fmt"
"gofound/searcher/words"
"io/ioutil"
Expand Down Expand Up @@ -116,6 +117,9 @@ func (c *Container) GetDocumentCount() int64 {

// DropDataBase 删除数据库
func (c *Container) DropDataBase(name string) error {
if _, ok := c.engines[name]; !ok {
return errors.New("数据库不存在")
}
err := c.engines[name].Drop()
if err != nil {
return err
Expand Down

0 comments on commit 801f149

Please sign in to comment.