|
|
@ -46,10 +46,20 @@ func genInsert(table Table, withCache, postgreSql bool) (string, string, error)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
camel := table.Name.ToCamel()
|
|
|
|
camel := table.Name.ToCamel()
|
|
|
|
text, err := pathx.LoadTemplate(category, insertTemplateFile, template.Insert)
|
|
|
|
var text string
|
|
|
|
|
|
|
|
var err error
|
|
|
|
|
|
|
|
// if database is postgresql
|
|
|
|
|
|
|
|
if postgreSql {
|
|
|
|
|
|
|
|
text, err = pathx.LoadTemplate(category, insertTemplateFile, template.InsertPg)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return "", "", err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
text, err = pathx.LoadTemplate(category, insertTemplateFile, template.Insert)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return "", "", err
|
|
|
|
return "", "", err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
output, err := util.With("insert").
|
|
|
|
output, err := util.With("insert").
|
|
|
|
Parse(text).
|
|
|
|
Parse(text).
|
|
|
@ -69,10 +79,18 @@ func genInsert(table Table, withCache, postgreSql bool) (string, string, error)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// interface method
|
|
|
|
// interface method
|
|
|
|
|
|
|
|
// if database is postgresql
|
|
|
|
|
|
|
|
if postgreSql {
|
|
|
|
|
|
|
|
text, err = pathx.LoadTemplate(category, insertTemplateMethodFile, template.InsertMethodPg)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return "", "", err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
text, err = pathx.LoadTemplate(category, insertTemplateMethodFile, template.InsertMethod)
|
|
|
|
text, err = pathx.LoadTemplate(category, insertTemplateMethodFile, template.InsertMethod)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return "", "", err
|
|
|
|
return "", "", err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
insertMethodOutput, err := util.With("insertMethod").Parse(text).Execute(map[string]interface{}{
|
|
|
|
insertMethodOutput, err := util.With("insertMethod").Parse(text).Execute(map[string]interface{}{
|
|
|
|
"upperStartCamelObject": camel,
|
|
|
|
"upperStartCamelObject": camel,
|
|
|
|