Skip to content

Commit

Permalink
fix: fix query unit test import list
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangtian committed May 8, 2024
1 parent 9932bbb commit d7a0969
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ func (g *Generator) generateQueryUnitTestFile(data *genInfo) (err error) {
}
err = render(tmpl.Header, &buf, map[string]interface{}{
"Package": g.queryPkgName,
"ImportPkgPaths": unitTestImportList.Add(structPkgPath).Add(data.ImportPkgPaths...).Paths(),
"ImportPkgPaths": unitTestQueryImportList.Add(structPkgPath).Add(data.ImportPkgPaths...).Paths(),
})
if err != nil {
return err
Expand Down
10 changes: 10 additions & 0 deletions import.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ var (
"gorm.io/driver/sqlite",
"gorm.io/gorm",
)
unitTestQueryImportList = new(importPkgS).Add(
"context",
"fmt",
"strconv",
"testing",
"",
"gorm.io/gen",
"gorm.io/gen/field",
"gorm.io/gorm/clause",
)
)

type importPkgS struct {
Expand Down

0 comments on commit d7a0969

Please sign in to comment.