Skip to content

Commit

Permalink
minor corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
k-takeuchi220 committed Mar 10, 2024
1 parent 25f371a commit 5378743
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
24 changes: 8 additions & 16 deletions generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,8 @@ func (g *Generator) generateQueryFile() (err error) {
return nil
}

queryOutPath, err := g.getQueryOutputPath()
if err != nil {
return err
}

if err = os.MkdirAll(queryOutPath, os.ModePerm); err != nil {
queryOutPath := g.getQueryOutputPath()
if err := os.MkdirAll(queryOutPath, os.ModePerm); err != nil {
return fmt.Errorf("create query pkg path(%s) fail: %s", queryOutPath, err)
}

Expand Down Expand Up @@ -384,8 +380,8 @@ func (g *Generator) generateQueryFile() (err error) {
return nil
}

func (g *Generator) getQueryOutputPath() (outPath string, err error) {
return filepath.Join(g.OutPath, g.QueryPkgPath) + string(os.PathSeparator), nil
func (g *Generator) getQueryOutputPath() (outPath string) {
return filepath.Join(g.OutPath, g.QueryPkgPath) + string(os.PathSeparator)
}

// generateSingleQueryFile generate query code and save to file
Expand Down Expand Up @@ -480,12 +476,8 @@ func (g *Generator) generateModelFile() error {
return nil
}

modelOutPath, err := g.getModelOutputPath()
if err != nil {
return err
}

if err = os.MkdirAll(modelOutPath, os.ModePerm); err != nil {
modelOutPath := g.getModelOutputPath()
if err := os.MkdirAll(modelOutPath, os.ModePerm); err != nil {
return fmt.Errorf("create model pkg path(%s) fail: %s", modelOutPath, err)
}

Expand Down Expand Up @@ -533,8 +525,8 @@ func (g *Generator) generateModelFile() error {
return nil
}

func (g *Generator) getModelOutputPath() (outPath string, err error) {
return filepath.Join(g.OutPath, g.ModelPkgPath) + string(os.PathSeparator), nil
func (g *Generator) getModelOutputPath() (outPath string) {
return filepath.Join(g.OutPath, g.ModelPkgPath) + string(os.PathSeparator)
}

func (g *Generator) fillModelPkgPath(filePath string) {
Expand Down
1 change: 1 addition & 0 deletions internal/model/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
const (
// DefaultModelPkg ...
DefaultModelPkg = "model"
// DefaultQueryPkg ...
DefaultQueryPkg = "query"
)

Expand Down

0 comments on commit 5378743

Please sign in to comment.