service/codecreate/codecreate.go

57 lines
2.1 KiB
Go
Raw Normal View History

2023-12-21 22:17:40 +08:00
package main
import (
"fmt"
"service/codecreate/consts"
"service/codecreate/generator"
)
func main() {
genSource := &generator.GenSource{
2024-03-12 12:06:45 +08:00
EntityName: "AccountPunishment",
ModuleName: "accountpunishment",
EntityCNName: "账号处罚",
ErrCodeSeq: "32",
2023-12-21 22:17:40 +08:00
}
2023-12-23 22:03:53 +08:00
generator.CreateFileDirectory(genSource)
2023-12-21 22:17:40 +08:00
genSource.InPath = consts.EntityInPath
genSource.OutPath = fmt.Sprintf("%v%v%v.go", consts.RootPath, consts.EntityOutPath, genSource.ModuleName)
generator.GenerateEntity(genSource)
2023-12-21 22:17:40 +08:00
genSource.InPath = consts.IdGeneratorInPath
genSource.OutPath = fmt.Sprintf("%v%v%v_idgenerator.go", consts.RootPath, consts.IdgeneratorOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
2023-12-21 22:17:40 +08:00
genSource.InPath = consts.MongoInPath
genSource.OutPath = fmt.Sprintf("%v%v%v_mongo.go", consts.RootPath, consts.MongoOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
2023-12-21 22:17:40 +08:00
2023-12-23 22:03:53 +08:00
genSource.InPath = consts.ProtoInPath
genSource.OutPath = fmt.Sprintf("%v%v%v/proto/%v_op.go", consts.RootPath, consts.ProtoOutPath, genSource.ModuleName, genSource.ModuleName)
generator.GenerateModule(genSource)
2023-12-21 22:17:40 +08:00
genSource.InPath = consts.ServiceInPath
genSource.OutPath = fmt.Sprintf("%v%v%v.go", consts.RootPath, consts.ServiceOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
2023-12-21 22:17:40 +08:00
genSource.InPath = consts.ServiceCenterInPath
genSource.OutPath = fmt.Sprintf("%v%v%v_service_center.go", consts.RootPath, consts.ServiceCenterOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
2023-12-21 22:17:40 +08:00
genSource.InPath = consts.ErrCodeInPath
genSource.OutPath = fmt.Sprintf("%v%v%v_errcode.go", consts.RootPath, consts.ErrcodeOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
2023-12-21 22:17:40 +08:00
genSource.InPath = consts.ControllerInPath
genSource.OutPath = fmt.Sprintf("%v%v%v_op.go", consts.RootPath, consts.ControllerOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
2023-12-21 22:17:40 +08:00
genSource.InPath = consts.ControllerCenterInPath
genSource.OutPath = fmt.Sprintf("%v%v%v_controller_center.go", consts.RootPath, consts.ControllerCenterOutPath, genSource.ModuleName)
generator.GenerateModule(genSource)
2023-12-21 22:17:40 +08:00
}