|
|
@ -1,6 +1,7 @@
|
|
|
|
package gen
|
|
|
|
package gen
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
|
|
|
|
"sort"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/collection"
|
|
|
|
"github.com/zeromicro/go-zero/core/collection"
|
|
|
@ -19,6 +20,10 @@ func genDelete(table Table, withCache, postgreSql bool) (string, string, error)
|
|
|
|
keySet.AddStr(key.DataKeyExpression)
|
|
|
|
keySet.AddStr(key.DataKeyExpression)
|
|
|
|
keyVariableSet.AddStr(key.KeyLeft)
|
|
|
|
keyVariableSet.AddStr(key.KeyLeft)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
keys := keySet.KeysStr()
|
|
|
|
|
|
|
|
sort.Strings(keys)
|
|
|
|
|
|
|
|
keyVars := keyVariableSet.KeysStr()
|
|
|
|
|
|
|
|
sort.Strings(keyVars)
|
|
|
|
|
|
|
|
|
|
|
|
camel := table.Name.ToCamel()
|
|
|
|
camel := table.Name.ToCamel()
|
|
|
|
text, err := pathx.LoadTemplate(category, deleteTemplateFile, template.Delete)
|
|
|
|
text, err := pathx.LoadTemplate(category, deleteTemplateFile, template.Delete)
|
|
|
@ -34,9 +39,9 @@ func genDelete(table Table, withCache, postgreSql bool) (string, string, error)
|
|
|
|
"containsIndexCache": table.ContainsUniqueCacheKey,
|
|
|
|
"containsIndexCache": table.ContainsUniqueCacheKey,
|
|
|
|
"lowerStartCamelPrimaryKey": util.EscapeGolangKeyword(stringx.From(table.PrimaryKey.Name.ToCamel()).Untitle()),
|
|
|
|
"lowerStartCamelPrimaryKey": util.EscapeGolangKeyword(stringx.From(table.PrimaryKey.Name.ToCamel()).Untitle()),
|
|
|
|
"dataType": table.PrimaryKey.DataType,
|
|
|
|
"dataType": table.PrimaryKey.DataType,
|
|
|
|
"keys": strings.Join(keySet.KeysStr(), "\n"),
|
|
|
|
"keys": strings.Join(keys, "\n"),
|
|
|
|
"originalPrimaryKey": wrapWithRawString(table.PrimaryKey.Name.Source(), postgreSql),
|
|
|
|
"originalPrimaryKey": wrapWithRawString(table.PrimaryKey.Name.Source(), postgreSql),
|
|
|
|
"keyValues": strings.Join(keyVariableSet.KeysStr(), ", "),
|
|
|
|
"keyValues": strings.Join(keyVars, ", "),
|
|
|
|
"postgreSql": postgreSql,
|
|
|
|
"postgreSql": postgreSql,
|
|
|
|
"data": table,
|
|
|
|
"data": table,
|
|
|
|
})
|
|
|
|
})
|
|
|
|