mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-10 00:20:00 +08:00
chore: refactor (#5071)
This commit is contained in:
@@ -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)))
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user