You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
619 B
Go
27 lines
619 B
Go
package gen
|
|
|
|
import (
|
|
"github.com/zeromicro/go-zero/tools/goctl/model/sql/template"
|
|
"github.com/zeromicro/go-zero/tools/goctl/util"
|
|
"github.com/zeromicro/go-zero/tools/goctl/util/pathx"
|
|
)
|
|
|
|
func genTableName(table Table) (string, error) {
|
|
text, err := pathx.LoadTemplate(category, tableNameTemplateFile, template.TableName)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
output, err := util.With("tableName").
|
|
Parse(text).
|
|
Execute(map[string]any{
|
|
"tableName": table.Name.Source(),
|
|
"upperStartCamelObject": table.Name.ToCamel(),
|
|
})
|
|
if err != nil {
|
|
return "", nil
|
|
}
|
|
|
|
return output.String(), nil
|
|
}
|