Feature add template version (#1152)

master
anqiansong 3 years ago committed by GitHub
parent bd26783b33
commit 9c48e9ceab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,6 +13,8 @@ import (
func genInsert(table Table, withCache, postgreSql bool) (string, string, error) { func genInsert(table Table, withCache, postgreSql bool) (string, string, error) {
keySet := collection.NewSet() keySet := collection.NewSet()
keyVariableSet := collection.NewSet() keyVariableSet := collection.NewSet()
keySet.AddStr(table.PrimaryCacheKey.DataKeyExpression)
keyVariableSet.AddStr(table.PrimaryCacheKey.KeyLeft)
for _, key := range table.UniqueCacheKey { for _, key := range table.UniqueCacheKey {
keySet.AddStr(key.DataKeyExpression) keySet.AddStr(key.DataKeyExpression)
keyVariableSet.AddStr(key.KeyLeft) keyVariableSet.AddStr(key.KeyLeft)

@ -10,6 +10,7 @@ import (
"strings" "strings"
"github.com/logrusorgru/aurora" "github.com/logrusorgru/aurora"
"github.com/tal-tech/go-zero/tools/goctl/internal/version"
) )
// NL defines a new line // NL defines a new line
@ -88,7 +89,7 @@ func GetTemplateDir(category string) (string, error) {
return "", err return "", err
} }
return filepath.Join(goctlHome, category), nil return filepath.Join(goctlHome, version.GetGoctlVersion(), category), nil
} }
// InitTemplates creates template files GoctlHome where could get it by GetGoctlHome // InitTemplates creates template files GoctlHome where could get it by GetGoctlHome

Loading…
Cancel
Save