Skip to content

Commit 46f0bfb

Browse files
refactor: controller utility file naming for clarity in Go-Gin server templates
1 parent bacd2f9 commit 46f0bfb

File tree

1 file changed

+8
-8
lines changed
  • internal/languages/golang/frameworks/go-gin-server

1 file changed

+8
-8
lines changed

internal/languages/golang/frameworks/go-gin-server/copier.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ const SQLServiceFile = "sqls-service.go.tmpl"
4242
const MySQLDaoFile = "mysql-dao.go.tmpl"
4343
const SQLModelFile = "sqls-model.go.tmpl"
4444

45-
// utils file for common functions in controllers
46-
const UtilsControllerFile = "common.go.tmpl"
45+
// common file for common utility functions in controllers
46+
const ControllersCommonFile = "common.go.tmpl"
4747

4848
const DaoFile = "dao.go.tmpl"
4949
const SQLiteDaoFile = "sqlite-dao.go.tmpl"
@@ -476,13 +476,13 @@ func (c *Copier) copyNoSQLDBResourceFiles(resourceName string, filePaths []*stri
476476
filePaths = append(filePaths, &targetResourceControllerFileName)
477477

478478
// copy controller common file to a generated project
479-
targetResourceControllerUtilsFileName := c.NodeDirectoryName + ControllersPath + "/" + UtilsControllerFile
480-
_, err = utils.CopyFile(targetResourceControllerUtilsFileName, c.TemplatesRootPath+ControllersPath+"/"+UtilsControllerFile)
479+
targetResourceControllerCommonFileName := c.NodeDirectoryName + ControllersPath + "/" + ControllersCommonFile
480+
_, err = utils.CopyFile(targetResourceControllerCommonFileName, c.TemplatesRootPath+ControllersPath+"/"+ControllersCommonFile)
481481
if err != nil {
482482
log.Debugf("error copying controller utils file: %v", err)
483483
return nil, err
484484
}
485-
filePaths = append(filePaths, &targetResourceControllerUtilsFileName)
485+
filePaths = append(filePaths, &targetResourceControllerCommonFileName)
486486

487487
// copy model files to a generated project
488488
targetResourceModelFileName := c.NodeDirectoryName + ModelsPath + "/" + resourceName + "-" + strings.Replace(NoSQLModelFile, "nosqls-", "", 1)
@@ -528,13 +528,13 @@ func (c *Copier) copySQLDBResourceFiles(resourceName string, filePaths []*string
528528
filePaths = append(filePaths, &targetResourceControllerFileName)
529529

530530
// copy controller common file to a generated project
531-
targetResourceControllerUtilsFileName := c.NodeDirectoryName + ControllersPath + "/" + UtilsControllerFile
532-
_, err = utils.CopyFile(targetResourceControllerUtilsFileName, c.TemplatesRootPath+ControllersPath+"/"+UtilsControllerFile)
531+
targetResourceControllerCommonFileName := c.NodeDirectoryName + ControllersPath + "/" + ControllersCommonFile
532+
_, err = utils.CopyFile(targetResourceControllerCommonFileName, c.TemplatesRootPath+ControllersPath+"/"+ControllersCommonFile)
533533
if err != nil {
534534
log.Debugf("error copying controller utils file: %v", err)
535535
return nil, err
536536
}
537-
filePaths = append(filePaths, &targetResourceControllerUtilsFileName)
537+
filePaths = append(filePaths, &targetResourceControllerCommonFileName)
538538

539539
// copy service files to a generated project
540540
targetResourceServiceFileName := c.NodeDirectoryName + ServicesPath + "/" + resourceName + "-" + strings.Replace(SQLServiceFile, "sqls-", "", 1)

0 commit comments

Comments
 (0)