chore: refactor (#5071)

This commit is contained in:
Kevin Wan
2025-08-09 12:27:43 +08:00
committed by GitHub
parent 130e1ba963
commit 9fd1f29845
2 changed files with 2 additions and 2 deletions

View File

@@ -43,7 +43,7 @@ func genMain(dir, rootPkg string, cfg *config.Config, api *spec.ApiSpec) error {
}
func genMainImports(parentPkg string) string {
imports := make([]string, 0, 5)
var imports []string
imports = append(imports, fmt.Sprintf("\"%s\"", pathx.JoinPackages(parentPkg, configDir)))
imports = append(imports, fmt.Sprintf("\"%s\"", pathx.JoinPackages(parentPkg, handlerDir)))
imports = append(imports, fmt.Sprintf("\"%s\"\n", pathx.JoinPackages(parentPkg, contextDir)))

View File

@@ -39,8 +39,8 @@ type Join []string
func genCacheKeys(prefix string, table parser.Table) (Key, []Key) {
var primaryKey Key
uniqueKey := make([]Key, 0, len(table.UniqueIndex))
primaryKey = genCacheKey(prefix, table.Db, table.Name, []*parser.Field{&table.PrimaryKey.Field})
uniqueKey := make([]Key, 0, len(table.UniqueIndex))
for _, each := range table.UniqueIndex {
uniqueKey = append(uniqueKey, genCacheKey(prefix, table.Db, table.Name, each))
}