mirror of
https://gitee.com/johng/gf.git
synced 2024-11-29 18:57:44 +08:00
cmd/gf: use automatic generating package names for go files of dao/do/entity instead of constant package names (#3639)
This commit is contained in:
parent
2ccbb02c71
commit
88f188d0f9
@ -118,6 +118,7 @@ generated json tag case for model struct, cases are as follows:
|
||||
tplVarGroupName = `{TplGroupName}`
|
||||
tplVarDatetimeStr = `{TplDatetimeStr}`
|
||||
tplVarCreatedAtDatetimeStr = `{TplCreatedAtDatetimeStr}`
|
||||
tplVarPackageName = `{TplPackageName}`
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -116,6 +116,7 @@ func generateDaoIndex(in generateDaoIndexInput) {
|
||||
tplVarTableName: in.TableName,
|
||||
tplVarTableNameCamelCase: in.TableNameCamelCase,
|
||||
tplVarTableNameCamelLowerCase: in.TableNameCamelLowerCase,
|
||||
tplVarPackageName: filepath.Base(in.DaoPath),
|
||||
})
|
||||
indexContent = replaceDefaultVar(in.CGenDaoInternalInput, indexContent)
|
||||
if err := gfile.PutContents(path, strings.TrimSpace(indexContent)); err != nil {
|
||||
|
@ -85,6 +85,7 @@ func generateDoContent(
|
||||
tplVarPackageImports: getImportPartContent(ctx, structDefine, true, nil),
|
||||
tplVarTableNameCamelCase: tableNameCamelCase,
|
||||
tplVarStructDefine: structDefine,
|
||||
tplVarPackageName: filepath.Base(in.DoPath),
|
||||
},
|
||||
)
|
||||
doContent = replaceDefaultVar(in, doContent)
|
||||
|
@ -70,6 +70,7 @@ func generateEntityContent(
|
||||
tplVarPackageImports: getImportPartContent(ctx, structDefine, false, appendImports),
|
||||
tplVarTableNameCamelCase: tableNameCamelCase,
|
||||
tplVarStructDefine: structDefine,
|
||||
tplVarPackageName: filepath.Base(in.EntityPath),
|
||||
},
|
||||
)
|
||||
entityContent = replaceDefaultVar(in, entityContent)
|
||||
|
@ -11,7 +11,7 @@ const TemplateGenDaoIndexContent = `
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
package {TplPackageName}
|
||||
|
||||
import (
|
||||
"{TplImportPrefix}/internal"
|
||||
|
@ -11,7 +11,7 @@ const TemplateGenDaoDoContent = `
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. {TplCreatedAtDatetimeStr}
|
||||
// =================================================================================
|
||||
|
||||
package do
|
||||
package {TplPackageName}
|
||||
|
||||
{TplPackageImports}
|
||||
|
||||
|
@ -11,7 +11,7 @@ const TemplateGenDaoEntityContent = `
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. {TplCreatedAtDatetimeStr}
|
||||
// =================================================================================
|
||||
|
||||
package entity
|
||||
package {TplPackageName}
|
||||
|
||||
{TplPackageImports}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user