service/codecreate/codecreate.go

65 lines
2.5 KiB
Go

package main
import (
"fmt"
"service/codecreate/consts"
"service/codecreate/generator"
)
func main() {
genSource := &generator.GenSource{
EntityName: "ActivityBanner",
ModuleName: "activity_banner",
EntityCNName: "活动banner表",
ErrCodeSeq: "51",
}
generator.CreateFileDirectory(genSource)
genSource.InPath = consts.EntityInPath
genSource.OutPath = fmt.Sprintf("%v%v%v.go", consts.RootPath, consts.EntityOutPath, genSource.ModuleName)
generator.GenerateEntity(genSource)
genSource.InPath = consts.IdGeneratorInPath
genSource.OutPath = fmt.Sprintf("%v%v%v_idgenerator.go", consts.RootPath, consts.IdgeneratorOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
genSource.InPath = consts.MongoInPath
genSource.OutPath = fmt.Sprintf("%v%v%v_mongo.go", consts.RootPath, consts.MongoOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
genSource.InPath = consts.ProtoOpInPath
genSource.OutPath = fmt.Sprintf("%v%v%v/proto/%v_op.go", consts.RootPath, consts.ProtoOutPath, genSource.ModuleName, genSource.ModuleName)
generator.GenerateModule(genSource)
genSource.InPath = consts.ProtoApiInPath
genSource.OutPath = fmt.Sprintf("%v%v%v/proto/%v_api.go", consts.RootPath, consts.ProtoOutPath, genSource.ModuleName, genSource.ModuleName)
generator.GenerateModule(genSource)
genSource.InPath = consts.ServiceInPath
genSource.OutPath = fmt.Sprintf("%v%v%v.go", consts.RootPath, consts.ServiceOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
genSource.InPath = consts.ServiceCenterInPath
genSource.OutPath = fmt.Sprintf("%v%v%v_service_center.go", consts.RootPath, consts.ServiceCenterOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
genSource.InPath = consts.ErrCodeInPath
genSource.OutPath = fmt.Sprintf("%v%v%v_errcode.go", consts.RootPath, consts.ErrcodeOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
genSource.InPath = consts.ControllerOpInPath
genSource.OutPath = fmt.Sprintf("%v%v%v_op.go", consts.RootPath, consts.ControllerOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
genSource.InPath = consts.ControllerApiInPath
genSource.OutPath = fmt.Sprintf("%v%v%v_api.go", consts.RootPath, consts.ControllerOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
genSource.InPath = consts.ControllerCenterInPath
genSource.OutPath = fmt.Sprintf("%v%v%v_controller_center.go", consts.RootPath, consts.ControllerCenterOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
}