Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wubin1989 committed Dec 17, 2023
1 parent 77801e6 commit 2cadfbe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
21 changes: 19 additions & 2 deletions toolkit/caches/caches.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,25 @@ func getTablesPostgres(db *gorm.DB) []string {
sql := db.Statement.SQL.String()
w := &walk.AstWalker{
Fn: func(ctx interface{}, node interface{}) (stop bool) {
if tableName, ok := node.(*tree.TableName); ok {
tableNames = append(tableNames, tableName.Table())
//log.Printf("%T", node)
switch expr := node.(type) {
case *tree.TableName:
tableNames = append(tableNames, expr.Table())
case *tree.Insert:
fmtCtx := tree.NewFmtCtx(tree.FmtSimple)
expr.Table.Format(fmtCtx)
tableName := fmtCtx.String()
tableNames = append(tableNames, tableName)
case *tree.Update:
fmtCtx := tree.NewFmtCtx(tree.FmtSimple)
expr.Table.Format(fmtCtx)
tableName := fmtCtx.String()
tableNames = append(tableNames, tableName)
case *tree.Delete:
fmtCtx := tree.NewFmtCtx(tree.FmtSimple)
expr.Table.Format(fmtCtx)
tableName := fmtCtx.String()
tableNames = append(tableNames, tableName)
}
return false
},
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package version

const Release = "v2.2.0"
const Release = "v2.2.1"

0 comments on commit 2cadfbe

Please sign in to comment.