patch model&rpc (#207)
* change column to read from information_schema * reactor generate mode from datasource * reactor generate mode from datasource * add primary key check logic * resolve rebase conflicts * add naming style * add filename test case * resolve rebase conflicts * reactor test * add test case * change shell script to makefile * update rpc new * update gen_test.go * format code * format code * update test * generates alias
This commit is contained in:
@@ -45,9 +45,9 @@ func main() {
|
||||
}
|
||||
`
|
||||
|
||||
func (g *defaultGenerator) GenMain(ctx DirContext, proto parser.Proto) error {
|
||||
func (g *defaultGenerator) GenMain(ctx DirContext, proto parser.Proto, namingStyle NamingStyle) error {
|
||||
dir := ctx.GetMain()
|
||||
serviceNameLower := formatFilename(ctx.GetMain().Base)
|
||||
serviceNameLower := formatFilename(ctx.GetMain().Base, namingStyle)
|
||||
fileName := filepath.Join(dir.Filename, fmt.Sprintf("%v.go", serviceNameLower))
|
||||
imports := make([]string, 0)
|
||||
pbImport := fmt.Sprintf(`"%v"`, ctx.GetPb().Package)
|
||||
@@ -63,7 +63,7 @@ func (g *defaultGenerator) GenMain(ctx DirContext, proto parser.Proto) error {
|
||||
|
||||
return util.With("main").GoFmt(true).Parse(text).SaveTo(map[string]interface{}{
|
||||
"head": head,
|
||||
"serviceName": serviceNameLower,
|
||||
"serviceName": strings.ToLower(stringx.From(ctx.GetMain().Base).ToCamel()),
|
||||
"imports": strings.Join(imports, util.NL),
|
||||
"pkg": proto.PbPackage,
|
||||
"serviceNew": stringx.From(proto.Service.Name).ToCamel(),
|
||||
|
||||
Reference in New Issue
Block a user