diff --git a/cmd/dolphin/gen/gen.go b/cmd/dolphin/gen/gen.go index b2e49786..83138b45 100644 --- a/cmd/dolphin/gen/gen.go +++ b/cmd/dolphin/gen/gen.go @@ -24,6 +24,7 @@ var lines = []pipe.Pipe{ &modules.Main{}, &modules.App{}, &modules.Ctr{}, + &modules.Proto{}, &modules.Srv{}, &modules.Model{}, &modules.Bean{}, @@ -128,5 +129,11 @@ func (gen *Gen) BuildWithCfg(cfg *pipe.TmplCfg) error { logrus.Error(err) } } + if cfg.GOProto && path.Ext(cfg.FilePath) == ".proto" { + cmd := exec.Command("protoc", "-I", path.Dir(cfg.FilePath), cfg.FilePath, "--go_out=plugins=grpc:"+path.Dir(cfg.FilePath)) + if err := cmd.Run(); err != nil && err != exec.ErrNotFound { + logrus.Error(err) + } + } return nil } diff --git a/cmd/dolphin/gen/modules/auto.go b/cmd/dolphin/gen/modules/auto.go index 2b544ec3..1b302c84 100644 --- a/cmd/dolphin/gen/modules/auto.go +++ b/cmd/dolphin/gen/modules/auto.go @@ -29,6 +29,7 @@ func (auto *Auto) Build(dir string, node *schema.Application) ([]*pipe.TmplCfg, "PackageName": node.PackageName, "Name": node.Name, "Controllers": node.Controllers, + "Services": node.Services, "Tables": node.Tables, } autoByte, _ := vfsutil.ReadFile(template.Assets, "auto.tmpl") diff --git a/cmd/dolphin/gen/modules/proto.go b/cmd/dolphin/gen/modules/proto.go new file mode 100644 index 00000000..cb3c7c6d --- /dev/null +++ b/cmd/dolphin/gen/modules/proto.go @@ -0,0 +1,56 @@ +// Copyright (c) 2018-2020 Double All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package modules + +import ( + "path" + + "github.com/2637309949/dolphin/cmd/dolphin/gen/pipe" + "github.com/2637309949/dolphin/cmd/dolphin/gen/template" + "github.com/2637309949/dolphin/cmd/dolphin/schema" + "github.com/2637309949/dolphin/packages/viper" + "github.com/shurcooL/httpfs/vfsutil" +) + +// Proto struct +type Proto struct { +} + +// Name defined pipe name +func (oa *Proto) Name() string { + return "proto" +} + +// Build func +func (oa *Proto) Build(dir string, node *schema.Application) ([]*pipe.TmplCfg, error) { + var tmplCfgs []*pipe.TmplCfg + ctrByte, _ := vfsutil.ReadFile(template.Assets, "proto.tmpl") + rpcByte, _ := vfsutil.ReadFile(template.Assets, "rpc.tmpl") + for _, s := range node.Services { + data := map[string]interface{}{ + "PackageName": node.PackageName, + "Name": node.Name, + "Service": s, + } + tmplCfg := &pipe.TmplCfg{ + Text: string(ctrByte), + FilePath: path.Join(dir, viper.GetString("dir.rpc"), "proto", s.Name+".proto"), + Data: data, + Overlap: pipe.OverlapInc, + GOFmt: false, + GOProto: true, + } + tmplCfgs = append(tmplCfgs, tmplCfg) + tmplCfg = &pipe.TmplCfg{ + Text: string(rpcByte), + FilePath: path.Join(dir, viper.GetString("dir.rpc"), s.Name+".go"), + Data: data, + Overlap: pipe.OverlapInc, + GOFmt: true, + } + tmplCfgs = append(tmplCfgs, tmplCfg) + } + return tmplCfgs, nil +} diff --git a/cmd/dolphin/gen/pipe/pipe.go b/cmd/dolphin/gen/pipe/pipe.go index 1fb46660..d7b9d6c9 100644 --- a/cmd/dolphin/gen/pipe/pipe.go +++ b/cmd/dolphin/gen/pipe/pipe.go @@ -12,6 +12,7 @@ type ( Data interface{} Overlap Overlap GOFmt bool + GOProto bool } // Pipe interface Pipe interface { diff --git a/cmd/dolphin/gen/template/assets.go b/cmd/dolphin/gen/template/assets.go index f4b42d36..943bc69d 100644 --- a/cmd/dolphin/gen/template/assets.go +++ b/cmd/dolphin/gen/template/assets.go @@ -21,7 +21,7 @@ var Assets = func() http.FileSystem { fs := vfsgen۰FS{ "/": &vfsgen۰DirInfo{ name: "/", - modTime: time.Date(2020, 5, 29, 2, 47, 32, 285061856, time.UTC), + modTime: time.Date(2020, 7, 1, 6, 58, 14, 886753247, time.UTC), }, "/api.tmpl": &vfsgen۰CompressedFileInfo{ name: "api.tmpl", @@ -46,10 +46,10 @@ var Assets = func() http.FileSystem { }, "/auto.tmpl": &vfsgen۰CompressedFileInfo{ name: "auto.tmpl", - modTime: time.Date(2020, 6, 13, 3, 50, 19, 70112971, time.UTC), - uncompressedSize: 2412, + modTime: time.Date(2020, 7, 1, 7, 59, 11, 713483757, time.UTC), + uncompressedSize: 2441, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x55\x5f\x6f\xe3\x36\x0c\x7f\xb6\x3e\x05\x67\x14\x07\x3b\xc8\xe4\xc3\x6e\xd8\xd0\x1b\xf2\x90\xe5\x7a\xb7\x3e\xb4\x57\x5c\xbb\xbd\x0c\xc3\xa0\xda\x8c\xa3\xcd\x91\x04\x59\x6e\x53\x18\xfa\xee\x07\xca\x76\x12\xe7\x4f\xfb\x64\x4a\x24\x7f\x24\x7f\x22\xe9\x2c\x83\x85\x2e\x10\x4a\x54\x68\x85\xc3\x02\x1e\x5f\xa0\xd0\x15\x3c\x36\xb2\x2a\x38\x7c\xfa\x0a\xb7\x5f\x1f\xe0\xea\xd3\xf5\x03\x67\x59\x06\xb5\x6e\x6c\x8e\x1f\x41\x34\x4e\xf3\x52\x33\x66\x44\xfe\xbf\x28\x11\x84\x31\x8c\xc9\xb5\xd1\xd6\x41\xc2\xa2\xd8\xc9\x35\xc6\x2c\x8a\xdb\x96\xdf\x75\x26\xb7\x62\x8d\xde\x67\x6b\x5d\x60\x15\x33\x16\xc5\xa5\x74\xab\xe6\x91\xe7\x7a\x9d\xfd\xf4\xcb\x87\x5f\x3f\xbc\xbf\xbc\xfc\xf9\x32\x2b\x74\x65\x56\x52\x65\x3d\x70\x9d\x3d\x49\x83\x36\x66\x29\xa3\xf8\x04\x02\xc6\xea\xff\x30\x77\xac\x6d\x7f\x84\x0b\x13\xae\x3e\xce\x80\x07\xc1\x7b\xf6\x24\x6c\x67\x37\x03\x0a\xdf\xc5\x8d\x59\x30\xb7\x42\x95\x08\x7c\xa1\x95\xb3\xba\xaa\xd0\xd6\xde\x77\x38\xb9\xb3\x01\xc5\x7b\x8a\xd3\xb6\xfc\x41\xff\x69\x0c\xda\x85\xa8\x11\x7a\x10\x28\x70\x29\x15\x16\xcc\xbd\x18\x3c\x67\x53\x3b\xdb\xe4\x0e\x5a\x16\x05\xdc\xf9\xdd\xf5\x7d\x00\x26\xc1\xfb\xee\xb6\x4b\xe3\x42\xaa\x02\x37\x53\xb8\x10\x46\x1e\x98\x8c\x90\x49\xdf\xa3\x93\xb3\x5c\x42\x25\x6a\xd7\xbb\x77\x11\xbc\x87\x65\xa3\xf2\x24\x77\x1b\x98\x50\x75\xb8\x71\x29\x19\x63\x55\xa3\xf7\xd3\x20\xaa\x62\x88\xdf\x89\xbe\xa3\x14\x9f\xdf\xa8\x96\x90\xcf\x9b\x25\x29\x4c\xce\x00\xb4\x2c\xea\x69\x7d\x77\xda\xa2\x1d\xf1\xb1\xad\x3f\x77\x96\x9f\x81\x9c\x41\xdb\xd2\x5b\x8d\x09\xa2\x8b\x81\xa0\x53\x6e\xfb\x55\x47\x16\x5d\x63\x15\xe4\xce\xf6\x0c\x9c\xf6\xf9\xa6\x1b\x87\xf5\x96\x84\xa1\x49\x46\xed\xe6\x7d\x47\xce\x6b\x08\x09\xaa\x52\x2a\x84\xc9\x55\xf8\xa6\xc4\x4a\x69\x75\x63\x08\xa5\xd3\xf1\x2f\x74\x4e\xfa\xc7\x55\x08\xfc\xce\xe2\x52\x6e\x20\x8e\xbd\x0f\x23\x14\x8e\x41\x1e\x9e\x34\x8c\x05\xff\x82\xee\xde\x59\xa9\xca\x24\x5e\x39\x67\xb8\x09\x86\x71\xba\x2d\x37\x3d\x49\x70\x88\xcf\xff\x10\xaa\xa8\x30\x89\x77\xd9\x03\xbf\x41\xb7\xd2\x85\xf7\xf1\x34\x0c\xcf\xfc\xee\xba\x4f\x85\xff\x85\xb6\x96\x5a\x79\x9f\xf5\xf7\xc2\xad\x76\xcc\x03\xa7\x73\xa7\xec\x27\xae\x2f\x87\xcf\x1b\x52\x4c\x81\xbe\xdb\xbc\x7a\x65\xe9\x20\xa9\x50\x01\xff\xa6\x2b\xac\x53\x78\x4f\x86\x41\x4e\xda\x96\x7f\xd6\x76\x2d\xfa\x02\x7b\x13\x88\xa7\xb1\xf7\xe9\x09\x1c\xbe\x10\xf9\x0a\x3b\x84\x20\x12\x42\x10\xbc\x9f\xd0\x3a\xe2\xf7\x98\x6b\x55\xec\x7c\xa7\x87\xef\x36\xbc\xaf\xf7\xd7\xaa\x76\x42\xe5\x78\xa6\x0d\xd3\xe3\x31\x3a\x6d\x38\xe0\x6c\xdb\x88\x96\xd3\x1b\xa6\xb3\xd7\x66\x8d\xb5\x6d\x17\x95\x62\xde\xbf\xa8\xfc\x86\xf6\x69\x3d\x9e\xd5\xdd\x7d\x92\x02\x5a\xab\x2d\x35\xdd\xba\x46\x17\xf6\xcc\xdc\x18\x7e\x23\x94\x28\xd1\xf2\x9b\x7b\x74\xc9\xb8\x49\x1e\xc4\x63\x85\xb4\x17\x3b\x0f\x3e\x2f\x8a\x44\xe1\x73\x12\x36\xf7\x39\x42\xf6\x7a\xf7\x77\xa9\x0a\x88\x63\x20\x82\xa9\x87\xe8\x3c\xb4\xee\x5e\x4b\x8e\xa7\x51\xc9\x8a\xed\x8a\x5a\x38\x7b\x5c\xd1\xc2\xd9\xfd\x72\xce\xae\xf3\xc3\xf5\x39\x9e\xc6\xb9\x31\x6f\x24\x70\xb5\xc1\xbc\x71\xda\x8e\xb7\xfd\xf6\xf6\xef\x7f\xc2\xa6\xed\x33\x09\x1e\xf3\xa2\x18\xa7\x9b\x88\xdc\xc1\x64\x70\x49\xc9\x20\x91\xc0\x39\xdf\x77\x4d\x77\x16\x54\xcf\x84\x7c\x66\xf4\x23\x45\x55\x24\x74\x9a\x82\xe4\x9c\xa7\xdb\x14\x45\xee\x46\x29\xe2\xeb\x41\x7b\xa3\x7d\xce\x96\xda\xc2\xbf\x53\x78\xa2\x2e\xe8\xb8\x0b\x51\x5b\x16\x45\x72\x49\x66\xa4\x78\x4a\xd2\xdf\x82\xfc\xc3\x8c\x58\x09\xda\x21\x05\xb4\x96\x45\x91\x67\xd1\x29\xe2\x6e\xf1\xf9\x88\xbb\xe1\xdf\x31\x28\xde\xa4\x21\x2c\xd7\x77\xc3\x0d\xfd\x20\x30\x74\xe0\x98\x0a\x3c\x78\xab\x93\x73\x76\xa4\x9c\x8d\x32\xd9\x4d\xc9\x74\xe8\xaf\x94\x75\x09\x4b\x25\x5d\x12\x36\xf5\x8e\x96\x43\x34\xbe\xe5\xf7\x88\xad\x4a\x97\xb6\xa9\xf9\x67\xe1\x44\x95\xa0\xb5\x29\xf1\xe5\xbf\x07\x00\x00\xff\xff\x86\x9d\xa2\xfd\x6c\x09\x00\x00"), + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x56\x4d\x6f\xe3\x36\x10\x3d\x9b\xbf\x62\x2a\x2c\x16\x52\xe0\x52\x8b\x6e\xd1\x22\x5b\xf8\xe0\x7a\xb3\xdb\x1c\x92\x35\xe2\xb4\x77\x46\x1a\xcb\x6c\x65\x92\xa0\x46\x89\x03\x81\xff\xbd\x20\x29\x39\x76\x62\x25\x39\x99\x22\xdf\x3c\xce\x9b\x2f\x3a\xcf\x61\xa1\x4b\x84\x0a\x15\x5a\x41\x58\xc2\xdd\x23\x94\xba\x86\xbb\x56\xd6\x25\x87\xaf\x3f\xe0\xfa\xc7\x2d\x5c\x7c\xbd\xbc\xe5\x2c\xcf\xa1\xd1\xad\x2d\xf0\x0b\x88\x96\x34\xaf\x34\x63\x46\x14\xff\x89\x0a\x41\x18\xc3\x98\xdc\x1a\x6d\x09\x52\x36\x49\x48\x6e\x31\x61\x93\xa4\xeb\xf8\x32\x42\xae\xc5\x16\x9d\xcb\xb7\xba\xc4\x3a\x61\x6c\x92\x54\x92\x36\xed\x1d\x2f\xf4\x36\xff\xe5\xb7\xcf\xbf\x7f\xfe\x74\x7e\xfe\xeb\x79\x5e\xea\xda\x6c\xa4\xca\x7b\xe2\x26\xbf\x97\x06\x6d\xf2\x7e\x7c\xad\x2b\xdb\x36\xef\x30\xa8\x05\xad\xb5\xdd\xe6\x2d\xc9\x3a\x61\x19\xf3\xfa\xbc\x93\x60\xac\xfe\x17\x0b\x62\x5d\xf7\x33\x7c\x30\x61\xeb\xcb\x0c\x78\x58\x38\xc7\xee\x85\x8d\xb8\x19\x78\x79\x51\x57\xc2\x02\xdc\x0a\x55\x21\xf0\x85\x56\x64\x75\x5d\xa3\x6d\x9c\x8b\x3c\x05\xd9\xc0\xe2\x9c\xbf\xa7\xeb\xf8\xad\xfe\xdb\x18\xb4\x0b\xd1\x20\xf4\x24\x50\xe2\x5a\x2a\x2c\x19\x3d\x1a\x1c\xc3\x34\x64\xdb\x82\xa0\x63\x93\xc0\x3b\x5f\x5e\xae\x02\xb1\x5f\x38\x17\x77\xa3\x1b\x1f\xa4\x2a\x71\x37\x85\x0f\xc2\xc8\x67\x90\x23\x66\x7f\xde\xb3\x7b\x63\xb9\x86\x5a\x34\xd4\x9b\xc7\x1b\x9c\x83\x75\xab\x8a\xb4\xa0\x1d\x9c\x79\x75\xb8\xa3\xcc\x83\xb1\x6e\xd0\xb9\x69\x58\xaa\x72\xb8\x3f\x2e\x5d\x0c\x29\x3e\xbc\xa1\xd6\x33\x8f\xc3\xd2\x0c\xce\x46\x08\x3a\x36\xe9\xc3\xfa\xf1\x34\xa2\x3b\x8a\xc7\x5e\x7f\x41\x96\x8f\x50\xce\xa0\xeb\x7c\xae\x8e\x03\xe4\x37\x86\x00\x9d\x32\x3b\x54\x3d\xb1\x48\xad\x55\x50\x90\xed\x23\x70\xda\xe6\x46\xb7\x84\xcd\x3e\x08\x43\x91\x1c\x95\x9b\x73\x31\x38\xaf\x31\xa4\xa8\x2a\xa9\x10\xce\x2e\xc2\x6f\xe6\xa3\x52\x59\xdd\x1a\xcf\x12\xcf\xf8\x77\xff\x9d\xf6\xc9\x55\x08\x7c\x69\x71\x2d\x77\x90\x24\xce\x85\x16\x0d\x9f\x61\x3d\xa4\x34\xb4\x1d\xff\x8e\xb4\x22\x2b\x55\x95\x26\x1b\x22\xc3\x4d\x00\x26\xd9\x5e\x6e\x76\x32\xc0\xe1\x7e\xfe\x97\x50\x65\x8d\x69\xf2\xe4\x3d\xf0\x2b\xa4\x8d\x2e\x9d\x4b\xa6\xa1\x79\xe6\xcb\xcb\xde\x15\xfe\x0f\xda\x46\x6a\xe5\x5c\xde\xef\x0b\xda\x3c\x45\x1e\xb8\xff\x8e\x87\x7d\xc7\xf5\x72\xf8\xbc\xf5\x07\x53\xf0\xbf\x7b\xbf\xfa\xc3\x8a\x20\xad\x51\x01\xbf\xd1\x35\x36\x19\x7c\xf2\xc0\xb0\x4e\xbb\x8e\x7f\xd3\x76\x2b\x7a\x81\x3d\x04\x92\x69\xe2\x5c\x76\x82\x87\x2f\x44\xb1\xc1\xc8\x10\x96\x9e\x21\x2c\x9c\x3b\xf3\xe3\x8e\xaf\xb0\xd0\xaa\x7c\xb2\x9d\x3e\xcf\xdb\x90\x5f\xe7\x2e\x55\x43\x42\x15\x38\x52\x86\xd9\xcb\x36\x3a\x0d\x1c\x78\xf6\x65\xe4\x87\xd3\x1b\xd0\xd9\x6b\xbd\xc6\xba\x2e\xde\x7a\x34\xcf\x56\x68\xef\x65\x81\xcd\xbb\x86\xd7\x2b\x15\xdb\xf3\x9c\x2a\x59\x63\x35\x69\x7e\x83\x95\x6c\x08\xed\xb8\x39\xda\x74\x28\xea\x9b\xe5\x62\x0a\x1f\xad\x29\x46\xa2\xd8\xb9\x8c\xc5\xe9\xdb\x4b\xca\x73\x58\x3d\xaa\xe2\xca\x3f\x41\xc7\xee\xee\xb7\xd3\x0c\xd0\x5a\x6d\xbd\x4b\xdb\x06\x29\x0c\xce\xb9\x31\xfc\x4a\x28\x51\xa1\xe5\x57\x2b\xa4\xf4\xb8\xea\x6f\xc5\x5d\x1d\x62\x13\x2d\xf8\xbc\x2c\x53\x85\x0f\x69\x78\xea\xc6\x32\x7c\xd0\x8c\x7f\x4a\x55\x42\x92\x80\xaf\x18\xdf\x14\xfe\x7b\xe8\xc5\x83\x1e\x3b\x1e\x2f\x4a\xd6\xec\x49\xd2\x82\xec\x4b\x41\x0b\xb2\x87\x72\x46\xdf\xa7\xe7\xef\xc1\xf1\x78\x99\x1b\xf3\x0e\x07\xfa\xcc\xbe\x74\x62\x48\xf9\x69\x47\x0e\x0a\x6b\xc4\x8b\xc1\xfe\x6d\x37\x2e\x76\x58\xb4\xa4\xed\xc9\x9e\x78\x71\x38\x03\xff\xee\xf3\x6b\x7c\x18\x8e\xd2\x7d\x11\x4c\x87\xf0\x4d\x0f\x25\x64\x2c\xaa\x92\x4a\x52\x1a\x6a\x56\xae\xbd\x28\x5f\x21\xcf\xe9\x79\xdc\xc0\x34\xfb\x23\x40\x7e\x9a\x79\x47\xbd\xcd\x24\xfe\x3f\xe1\xdf\x04\x89\x3a\x45\x6b\x33\x36\x71\xcc\xfd\x1f\x00\x00\xff\xff\x46\xd6\x1a\x20\x89\x09\x00\x00"), }, "/axios.tmpl": &vfsgen۰CompressedFileInfo{ name: "axios.tmpl", @@ -88,8 +88,8 @@ var Assets = func() http.FileSystem { }, "/boilerplate/go.mod": &vfsgen۰FileInfo{ name: "go.mod", - modTime: time.Date(2020, 5, 28, 8, 1, 21, 990216747, time.UTC), - content: []byte("\x6d\x6f\x64\x75\x6c\x65\x20\x7b\x7b\x2e\x50\x61\x63\x6b\x61\x67\x65\x4e\x61\x6d\x65\x7d\x7d\x0a\x0a\x67\x6f\x20\x31\x2e\x31\x33\x0a\x0a\x72\x65\x71\x75\x69\x72\x65\x20\x28\x0a\x09\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x32\x36\x33\x37\x33\x30\x39\x39\x34\x39\x2f\x64\x6f\x6c\x70\x68\x69\x6e\x20\x76\x30\x2e\x30\x2e\x30\x2d\x32\x30\x32\x30\x30\x35\x32\x38\x30\x38\x30\x30\x31\x36\x2d\x61\x33\x35\x39\x37\x37\x61\x62\x62\x63\x66\x66\x0a\x09\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x67\x6f\x2d\x73\x71\x6c\x2d\x64\x72\x69\x76\x65\x72\x2f\x6d\x79\x73\x71\x6c\x20\x76\x31\x2e\x35\x2e\x30\x0a\x29\x0a"), + modTime: time.Date(2020, 6, 27, 3, 44, 44, 617863645, time.UTC), + content: []byte("\x6d\x6f\x64\x75\x6c\x65\x20\x7b\x7b\x2e\x50\x61\x63\x6b\x61\x67\x65\x4e\x61\x6d\x65\x7d\x7d\x0a\x0a\x67\x6f\x20\x31\x2e\x31\x33\x0a\x0a\x72\x65\x71\x75\x69\x72\x65\x20\x28\x0a\x09\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x32\x36\x33\x37\x33\x30\x39\x39\x34\x39\x2f\x64\x6f\x6c\x70\x68\x69\x6e\x20\x76\x30\x2e\x30\x2e\x30\x2d\x32\x30\x32\x30\x30\x36\x32\x37\x30\x33\x33\x38\x32\x39\x2d\x37\x62\x64\x66\x34\x31\x33\x30\x35\x63\x64\x32\x0a\x09\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x67\x6f\x2d\x73\x71\x6c\x2d\x64\x72\x69\x76\x65\x72\x2f\x6d\x79\x73\x71\x6c\x20\x76\x31\x2e\x35\x2e\x30\x0a\x29\x0a"), }, "/boilerplate/go.sum": &vfsgen۰CompressedFileInfo{ name: "go.sum", @@ -149,10 +149,10 @@ var Assets = func() http.FileSystem { }, "/ctr.tmpl": &vfsgen۰CompressedFileInfo{ name: "ctr.tmpl", - modTime: time.Date(2020, 6, 12, 2, 28, 14, 143472509, time.UTC), - uncompressedSize: 6505, + modTime: time.Date(2020, 6, 30, 9, 7, 11, 230515293, time.UTC), + uncompressedSize: 6857, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x58\x5f\x6f\xdb\x38\x12\x7f\xb6\x3e\xc5\x9c\x10\x14\xf2\xc1\x91\xd2\x3f\xd7\x43\x73\x08\xd0\x24\xbe\x14\x39\xe0\xd2\x5c\xec\xf4\x1e\x8a\xa2\xa0\xa5\xb1\xcd\x46\x26\x15\x8a\x4a\xe3\x25\xf4\xb0\x8f\x0b\xec\xc7\xe8\xf3\xee\x07\xd8\xaf\xb3\xc0\xf6\x63\x2c\x86\xa2\xe4\x3f\x71\xd3\x3a\x49\xbb\x1b\x60\x9f\x4c\x93\x33\x9c\x99\xdf\x6f\x66\x44\x32\x8a\x60\x5f\x26\x08\x23\x14\xa8\x98\xc6\x04\x06\x53\x48\x64\x0a\x83\x82\xa7\x49\x08\x2f\x45\x3a\x85\x17\x6e\x91\xd6\xb4\x94\x69\x0e\x7c\x08\x42\x6a\xc0\x4b\x9e\x6b\x4c\x42\x2f\x8a\x20\x97\x85\x8a\x71\x1b\x8c\x09\xf7\xa5\xd0\x4a\xa6\x29\xaa\xf0\x88\x4d\xb0\x2c\xc3\x91\xf4\xbc\x8c\xc5\x67\x6c\x84\xc0\xb2\xcc\xf3\xf8\x24\x93\x4a\x43\xe0\xb5\x7c\x63\xc2\xe3\x6a\xa9\x12\x8e\x26\x32\xc1\xd4\x5f\xb5\x92\xab\x0b\xdf\xf3\x5a\xfe\x88\xeb\x71\x31\x08\x63\x39\x89\x1e\x3d\x7d\xfc\xcf\xc7\x5b\xcf\x9e\x3d\x79\x16\x25\x32\xcd\xc6\x5c\x44\xce\x50\x1e\x8d\xb8\x88\x06\x5c\x24\x5c\x8c\xfc\x35\xb4\xe4\xe6\xb0\x10\x67\x6b\x68\x88\x22\x4d\xd7\x10\xd7\x7c\x82\xbe\xd7\xf6\x8c\x51\x4c\x8c\x10\xe6\xf1\xda\x3d\x3e\xec\x95\x25\xe1\x69\xcc\xc6\xfc\x42\x5f\x9e\x66\x19\xaa\x7d\x96\x23\x6c\x5c\x45\xd8\x98\x05\x09\x37\x0b\x2c\xe3\xc0\x27\x59\x8a\x13\x14\x9a\x69\x2e\x05\x6d\xfd\xbc\x57\x4c\x26\x4c\x4d\x89\xab\x2e\xe6\x71\x59\x82\x9d\xee\xb3\x51\xbe\x6c\xb7\x5a\xf7\x8c\xd9\xb4\xa4\x23\x84\xaf\x50\xe5\x5c\x0a\xf0\x7d\xa8\x3c\x7d\x7e\xe1\x66\x8c\xa9\x17\x9d\x06\x8a\x64\x51\xf7\xbf\xa8\xc7\x32\x01\x7f\x84\xda\x77\xca\xbb\x71\x8c\x99\x06\x63\xf8\x10\x46\x1a\x82\x14\x05\x84\xc7\x4c\xb1\x49\xde\x86\x87\x65\x39\x29\x52\xcd\x33\xa6\x74\x34\x94\x6a\xb2\x99\x30\xcd\x8c\xc1\x34\xc7\xb2\x64\x59\x96\xf2\xd8\x86\x15\xbd\xcb\xa5\x30\x66\x66\x70\x36\xda\x20\x10\xb6\x77\x20\x9c\xb9\x12\xee\x16\x7a\xec\xec\x5b\x53\x40\x13\x52\xf1\xef\xec\x66\x30\x46\x96\xa0\x82\x5c\x2b\x2e\x46\x30\x64\x69\x8e\xe0\x7f\xfc\xe9\xc3\xc7\x9f\xbf\xff\xf5\x97\x0f\xbf\xfd\xf0\xa3\xbf\x64\xc3\x11\x59\xb9\xbd\xb0\xb1\x31\x35\x17\x36\x42\x3c\xb7\xfe\x2c\x01\x01\xe7\x05\x5a\x3a\x28\x2e\xb0\xb2\x35\x64\x16\x0f\xab\xd2\x60\x02\x65\x49\x50\x74\x2d\x12\x9b\x50\x61\x31\x90\xc9\xb4\xf1\xa9\x19\x90\xf9\x13\x1c\x42\xd8\x9f\x66\xe4\x83\x0b\xa5\xe1\x7d\x3e\x0e\xf2\xf9\x80\xf1\xb4\x50\x08\x4f\xb6\x1e\x83\x91\x83\x77\x18\xeb\x12\x6c\x3d\x86\xb4\x34\x4f\xe5\x09\xea\x42\x89\xb0\x57\xc4\x31\xe6\xb9\x35\x00\x7e\x4d\xaa\x9b\x85\x47\x5b\x5b\xb3\x7d\x6a\x5f\x56\x68\x7e\x2a\x5f\x9c\xa8\x73\x6b\xc9\x48\xed\xec\x3f\xae\x31\x32\xaf\xb9\x60\x84\x36\x38\x91\x85\x46\x05\x11\xcb\xb8\x31\x54\x7a\xc7\x0a\x87\xfc\x12\x66\x59\x1c\xb9\x79\xa6\xc7\x57\xab\x8e\xf8\xa6\x34\x8a\x66\x1c\xbf\x36\xc6\x51\x5b\x96\x6f\xbc\x61\x21\xe2\x3b\xa9\xe3\x20\xd6\x97\xf0\x77\x12\xc6\x4b\xdd\x06\x53\x43\x84\xe7\x10\x1e\x90\x11\x3f\x63\x23\x24\x5c\x5a\xe7\x94\xea\xb1\xbe\xb4\x11\xff\x8f\xd2\x2a\x68\x7b\xad\x55\x39\x6a\x27\x37\xf4\x85\xad\x8d\xbe\x24\xf9\x57\x2c\x2d\xb0\x4a\x16\x08\xed\x1f\xbb\x65\xd8\x43\x6d\x1d\xeb\x73\x9d\x62\x9d\x4c\x81\xdf\xc4\xed\xcf\x28\xf3\x7d\xda\xb3\x2c\x3b\x14\x38\x0d\x1a\xc8\x9d\x1b\x15\xfc\x2d\xa7\x61\x33\xdb\x55\x63\x65\xe8\xa4\x48\x91\xb6\x5e\x01\xce\xdb\x99\xc1\xc5\xcd\xac\x22\x75\x2f\x8a\x55\xa1\xee\x00\x2a\x55\x03\x71\xcc\x46\xd8\x43\xa6\xe2\x31\xc1\x18\x76\xf7\x3a\xb0\x7a\x7b\xdf\x2e\x2c\xfe\xe9\xb3\x41\x5a\xfd\x3b\xaf\x00\x09\xda\x6d\xaf\x45\xd0\x2b\x05\x7f\xdb\x01\xc1\x53\x30\x5e\xab\x45\x3b\x53\xae\x05\xa8\x54\xdb\x6b\x91\x13\x85\x12\x5e\xab\xf4\xec\x92\xcb\xf5\x40\xa1\x6e\x7b\x75\xd1\x2e\x32\xa8\x15\xfe\xc5\xe0\x6a\x06\xfb\x0a\xef\x03\x83\x2c\x49\xfc\x86\x95\x41\x46\xde\x73\x91\xe0\x65\xcd\x18\x6c\xd1\xea\x05\x53\x90\xb1\x69\x2a\x59\x42\x00\x0f\x32\xdb\xaf\xe8\xd7\xf5\xa8\xda\x37\x17\x7c\x6f\x2c\x8b\x34\xd9\xe3\x22\xd9\x93\xc9\xf4\xff\x5c\x8f\x83\x07\x4e\xbf\x03\xee\x74\x13\xfe\xa7\xf7\xf2\xa8\xfd\xaf\x35\x42\xaa\x3f\x84\x87\xbd\x5d\xa5\xd8\x74\xc1\x3e\x9d\x7e\xc2\x03\xa9\xfe\xcd\xe2\x71\xd0\x98\xa2\x66\x16\xd0\x77\xc7\x79\xfd\x72\xd1\xed\xb6\xb5\x48\xeb\xe1\x61\x17\x76\x80\xce\x44\x61\xcf\x7e\x40\x0f\x94\x9c\x9c\x9e\x1e\x76\x89\xda\x4a\x62\x5f\x21\xd3\xd8\xe7\x13\xac\x25\x69\x4c\x72\x01\x1d\x8e\xc2\x23\xf9\x3e\x68\xcf\xb1\x35\xaf\xb5\x37\xbd\xba\xbb\x4d\x8b\x17\xa8\xfb\xf2\x0c\x45\xd0\xa6\xe1\x69\x8e\x8a\x4c\x36\xda\xa7\x59\x72\x03\x9b\x95\xd6\x4d\x6d\x76\x31\x3d\x48\xd9\xa8\x56\x3e\x14\xda\x6a\x6e\xb5\xbd\x56\x53\x4c\xf6\xeb\xed\xb5\x1c\xce\xd7\x82\x57\xcb\xac\x0b\xdf\xa2\xde\xfa\xc1\xd4\xfa\xeb\x42\xb8\xa8\x77\x73\xbb\xd7\xc0\x38\xd7\x42\x96\xbb\x46\x77\x2f\x3c\x14\x39\x2a\xdd\xd4\xcb\x57\xaa\xfb\x04\x53\xd4\xf8\x05\xa5\x6f\x57\x79\xbe\x5b\xf9\x48\xb5\xb3\xaa\xfc\xea\xbe\x6a\x05\xbf\xac\x63\x90\x04\x4f\x72\x78\xfd\xa6\x3a\xb2\x7e\x9b\x1e\x72\x8b\x3e\x41\xce\xee\xd0\x4d\x10\x45\x12\xf0\x24\xef\x80\xeb\x1c\x2e\x37\x5c\x81\xac\xa4\x34\xf0\x79\xe2\x77\x28\xde\xb6\xcb\xac\xe0\xc1\x4a\x53\x64\x68\x96\xb2\xdb\x9f\xcf\xd8\x4e\xa3\xb0\x37\xdd\x06\x58\x27\x59\x49\xd5\xa5\x29\x69\x2e\x26\xea\x43\x5a\xa6\x78\x6e\x9b\x7f\x4d\xc7\x80\x3f\xcf\x97\xe4\x3a\x8e\x66\x4d\xad\xe6\xf5\xbe\x31\x76\x17\x7c\xcd\xee\xa4\x57\x5a\x47\x61\x7d\xff\xa3\x5b\x07\x45\x88\x4a\x49\x55\xfd\x55\xa8\xe1\xf5\x1b\x2e\xf4\xd3\x27\x6e\x02\xdc\x1f\x87\xc6\xd7\x4c\xa7\x7c\x2e\x8f\x8e\xf0\x7d\x0f\x73\xba\x89\xd1\xd7\xef\xb6\xc7\x92\xdb\x7d\xca\xd7\x3e\x3e\xa8\x8e\xc3\x2a\x0f\x0f\xbb\xc1\x52\x7b\x6b\xca\x80\xe6\x1d\x02\xb3\x86\x68\x4b\x4a\xb5\x3f\x95\x81\x79\x78\x22\xd3\x74\xc0\xe2\x33\x7b\xa2\xba\xef\x0d\xe4\xae\x4e\x09\xeb\x32\xb4\xaa\x71\x75\x83\x6b\x5a\xd6\x5d\x9d\x22\x3e\xdb\x15\xa4\xf8\x92\x96\x60\x2b\x57\x68\xae\xa7\xee\x85\x66\xf9\xed\xc0\xdd\x7c\xbc\x16\x4f\xea\x18\xab\xeb\xa4\x5f\x91\x3d\xbb\x88\xbd\x5d\x01\x04\x4f\x2c\xd0\xc1\x83\xca\xc6\x6d\xa2\xae\x77\x98\x3f\xef\xce\xbd\x60\x2c\x3d\x0a\xde\x9b\x0b\xf0\x7c\x02\xe5\xea\x22\x5c\xef\xa5\x67\x37\xd6\xd4\xd8\xce\xef\x28\x9d\x16\x61\xad\x1f\x0e\x9b\x47\xc3\xad\xbb\xb8\x98\xce\x1b\x9a\x97\xce\xb5\x2a\x62\x6d\xca\x05\x74\xbe\xf5\xd9\xe3\xc6\x0c\x7c\xad\xb2\xb6\x23\x1a\xdb\xd1\xef\x01\x00\x00\xff\xff\xe5\x21\x57\xac\x69\x19\x00\x00"), + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x58\xcd\x6e\x1b\x39\x12\x3e\xab\x9f\xa2\xb6\x61\x04\xad\x85\xdc\x72\x7e\x36\x8b\x78\x61\x20\xb6\x15\x07\x5e\x60\x1d\xaf\x25\x67\x0f\x41\x10\x50\xdd\x25\x89\x31\x45\xb6\xd9\x6c\xc7\x5a\xa2\x0f\x73\x1c\x60\x1e\x23\xe7\x99\x07\x98\xd7\x19\x60\xf2\x18\x83\x62\xb3\xf5\x67\xc5\x89\x1c\xc7\x33\xc1\xcc\x49\x14\xc9\x62\x55\x7d\xdf\xc7\x6a\x92\xed\x36\xec\xab\x14\x61\x88\x12\x35\x33\x98\x42\x7f\x02\xa9\x12\xd0\x2f\xb8\x48\x63\x78\x21\xc5\x04\x9e\xfb\x41\x1a\x33\x4a\x89\x1c\xf8\x00\xa4\x32\x80\x97\x3c\x37\x98\xc6\x41\xbb\x0d\xb9\x2a\x74\x82\xdb\x60\x6d\xbc\xaf\xa4\xd1\x4a\x08\xd4\xf1\x11\x1b\x63\x59\xc6\x43\x15\x04\x19\x4b\xce\xd8\x10\x81\x65\x59\x10\xf0\x71\xa6\xb4\x81\x28\x68\x84\xd6\xc6\xc7\xd5\x50\x35\xb9\x3d\x56\x29\x8a\x70\xd5\x48\xae\x2f\xc2\x20\x68\x84\x43\x6e\x46\x45\x3f\x4e\xd4\xb8\xfd\xe0\xf1\xc3\x7f\x3e\xdc\x7a\xf2\xe4\xd1\x93\x76\xaa\x44\x36\xe2\xb2\xed\x1d\xe5\xed\x21\x97\xed\x3e\x97\x29\x97\xc3\x70\x0d\x2b\xb5\x39\x28\xe4\xd9\x1a\x16\x42\x0d\x75\x91\xaf\x61\x20\x0b\x21\xd6\x98\x6e\xf8\x18\xc3\xa0\x19\x58\xab\x99\x1c\x22\xcc\x03\xbc\x7b\x7c\xd8\x2d\x4b\x22\xc0\xda\x8d\xf9\x81\x9e\x3a\xcd\x32\xd4\xfb\x2c\x47\xd8\xb8\x4a\x89\xb5\x0b\x33\x7c\x2f\xb0\x8c\x03\x1f\x67\x02\xc7\x28\x0d\x33\x5c\x49\x5a\xfa\x69\xb7\x18\x8f\x99\x9e\x10\xb9\x1d\xcc\x93\xb2\x04\xd7\xdd\x63\xc3\x7c\xd9\x6f\x35\x1e\x58\xbb\xe9\x54\x82\x10\xbf\x44\x9d\x73\x25\x21\x0c\xa1\x8a\xf4\xe9\x85\xef\xb1\xb6\x1e\xf4\x16\x28\xd3\x45\xdb\xff\xa0\x19\xa9\x14\xc2\x21\x9a\xd0\x1b\xef\x26\x09\x66\x06\xac\xe5\x03\x18\x1a\x88\x04\x4a\x88\x8f\x99\x66\xe3\xbc\x09\xf7\xcb\x72\x5c\x08\xc3\x33\xa6\x4d\x7b\xa0\xf4\x78\x33\x65\x86\x59\x8b\x22\xc7\xb2\x64\x59\x26\x78\xe2\xd2\x6a\xbf\xcd\x95\xb4\x76\xe6\x70\xd6\xda\x20\x10\xb6\x77\x20\x9e\x85\x12\xef\x16\x66\xe4\xfd\x3b\x57\x40\x1d\x4a\xf3\xff\xbb\xc5\x60\x84\x2c\x45\x0d\xb9\xd1\x5c\x0e\x61\xc0\x44\x8e\x10\x7e\xf8\xf1\xfd\x87\x9f\xbe\xfb\xe5\xe7\xf7\xbf\x7e\xff\x43\xb8\xe4\xc3\x13\x59\x85\xbd\xb0\xb0\xb5\x35\x17\x2e\x43\x3c\x77\xf1\x2c\x01\x01\xe7\x05\x3a\x3a\x28\x2f\x70\x73\x6b\xc8\x1c\x1e\xce\x64\x8a\x09\x94\x25\x41\xd1\x71\x48\x6c\x42\x85\x45\x5f\xa5\x93\x69\x4c\xd3\x06\xb9\x3f\xc1\x01\xc4\xbd\x49\x46\x31\xf8\x54\xa6\xbc\xcf\xe7\x41\x31\x1f\x30\x2e\x0a\x8d\xf0\x68\xeb\x21\x58\xd5\x7f\x8b\x89\x29\xc1\x6d\xe0\x98\x86\xe6\xa9\x3c\x41\x53\x68\x19\x77\x8b\x24\xc1\x3c\x77\x0e\x20\xac\x49\xf5\xbd\xf0\x60\x6b\x6b\xb6\x4e\x1d\xcb\x0a\xcb\x8f\xe9\xc5\x4f\xf5\x61\x2d\x39\xa9\x83\xfd\xc7\x35\x4e\xe6\x2d\x17\x9c\xd0\x02\x27\xaa\x30\xa8\xa1\xcd\x32\x6e\x2d\x6d\xbd\x63\x8d\x03\x7e\x09\x33\x15\xb7\x7d\x3f\x33\xa3\xab\xbb\x8e\xf8\x26\x19\xb5\x67\x1c\xbf\xb2\xd6\x53\x5b\x96\xaf\x83\x41\x21\x93\x5b\xd9\xc7\x51\x62\x2e\xe1\xef\x34\x19\x2f\x4d\x13\x6c\x0d\x11\x9e\x43\x7c\x40\x4e\xc2\x8c\x0d\x91\x70\x69\x9c\x93\xd4\x13\x73\xe9\x32\xfe\x2f\xc9\x2a\x6a\x06\x8d\x55\x1a\x75\x9d\x1b\xe6\xc2\xed\x8d\x9e\xa2\xf9\x2f\x99\x28\xb0\x12\x0b\xc4\xee\x8f\x5b\x32\xee\xa2\x71\x81\xf5\xb8\x11\x58\x8b\x29\x0a\xa7\x79\x87\x33\xca\xc2\x90\xd6\x2c\xcb\x16\x25\x4e\x8d\x29\xe4\x3e\x8c\x0a\xfe\x86\xb7\x70\xca\xf6\xbb\xb1\x72\x74\x52\x08\xa4\xa5\x57\x80\xf3\x66\xe6\x70\x71\x31\x67\x48\xd5\x8b\x72\xd5\x68\x5a\x80\x5a\xd7\x40\x1c\xb3\x21\x76\x91\xe9\x64\x44\x30\xc6\x9d\xbd\x16\xac\x5e\x3e\x74\x03\x8b\x7f\x7a\xac\x2f\xaa\x7f\xe7\x15\x20\x51\xb3\x19\x34\x08\x7a\xad\xe1\x6f\x3b\x20\xb9\x00\x1b\x34\x1a\xd5\x37\x23\x7e\xa6\xb5\xd2\x11\x6a\xdd\x0c\x1a\x0d\xf2\x46\xfa\xab\xff\x6b\x27\xc9\xa0\x51\x06\x6e\xc8\xeb\x3f\xd2\x68\x9a\x41\xbd\x91\x17\x59\x35\x1a\xff\x62\x75\x35\xab\x3d\x8d\xdf\x2a\xab\x2c\x4d\xc3\x29\x53\xfd\x8c\x32\xe2\x32\xc5\xcb\x9a\x45\xd8\xa2\xd1\x0b\xa6\x21\x63\x13\xa1\x58\x4a\xa0\xf7\x33\x57\xd7\xe8\xd7\xd7\xb2\x3a\x5e\x0f\x48\x77\xa4\x0a\x91\xee\x71\x99\xee\xa9\x74\xf2\x3f\x6e\x46\xd1\x3d\x6f\xdf\x02\x7f\x6c\x8a\xff\xdd\x7d\x71\xd4\xfc\xd7\x52\x9a\x00\x00\x6b\x66\x5a\x7f\x47\x0f\xbb\xbb\x5a\xb3\xc9\x42\x58\x74\xda\x8a\x0f\x94\x7e\xc6\x92\x51\x34\x8d\x80\x6a\x61\x44\x9f\x2d\x9f\xcc\x8b\xc5\x6c\x9a\x0e\x6f\x1a\x8f\x0f\x3b\xb0\x03\x74\xa4\x8a\xbb\xee\xfb\x7b\xa0\xd5\xf8\xf4\xf4\xb0\x43\x2a\xa8\x66\xec\x6b\x64\x06\x7b\x7c\x8c\xf5\x4c\x6a\xd3\xbc\x88\xce\x56\xf1\x91\x7a\x17\x35\xe7\x88\x9d\xb7\xda\x9b\x5c\x5d\xdd\x29\xe8\x39\x9a\x9e\x3a\x43\x19\x35\xa9\x79\x9a\xa3\x26\x97\x53\xeb\xd3\x2c\xbd\x81\xcf\xca\xea\xa6\x3e\x3b\x28\x0e\x04\x1b\xd6\xc6\x87\xd2\x38\xcb\xad\x66\xd0\x98\xee\x3b\xf7\xf1\x0f\x1a\x1e\xe7\x6b\xc1\xab\xe7\xac\x0b\xdf\xa2\xdd\xfa\xc9\xd4\xf6\xeb\x42\xb8\x68\x77\x73\xbf\xd7\xc0\x38\x57\x6d\x96\x0b\x4c\x67\x2f\x3e\x94\x39\x6a\x33\xdd\x46\x77\x58\x22\x52\x14\x68\xf0\x33\xaa\x84\x1b\xe5\xf9\x6e\x15\x37\xed\xa7\x55\x5b\xb2\x2e\xcb\x6e\xe2\xe7\x15\x17\x9a\xc1\xd3\x1c\x5e\xbd\xae\x4e\xc1\xb7\x57\x6e\xd6\x85\xec\x0b\xea\x09\x25\xb0\x43\x37\x54\x94\x69\xc4\xd3\xbc\x05\xbe\xc2\x78\x0d\xf9\x8d\xb4\x92\xfa\x28\xe4\x69\xd8\x22\x0c\x9a\x5e\x81\xd1\xbd\x95\xae\xc8\xd1\x4c\xda\xdb\x9f\x56\x76\x6b\x6a\xb0\x37\xd9\x06\x58\x47\xd4\x64\xea\xe5\x4c\x96\x8b\x82\xbe\x4f\xc3\x94\xcf\xd7\xd0\xe9\xb4\xda\xc0\xdd\x7e\x9c\xd6\x0d\xfc\x3a\x2e\x67\x45\xb2\xe6\xff\x5b\x63\xf6\x2a\xaf\xeb\x73\x38\xbb\x22\x5f\x29\x3b\x85\x8b\xfd\xf7\x2e\x3b\x94\x21\x12\xdd\xd5\x5f\x8d\x06\x5e\xbd\xe6\xd2\x3c\x7e\xe4\x3b\xc0\xff\xf1\x68\xdc\xb5\xc4\xf2\x39\x6d\x1d\xe1\xbb\x2e\xe6\x74\x59\xa4\x2f\xec\x97\x1e\x7d\xbe\xec\xb8\xb0\xf6\x11\x45\xb7\x3c\x7e\x79\x7c\xd8\x89\x96\x4a\xe3\x74\x6b\x50\xbf\x47\x60\x56\x4c\xdd\x36\xd3\xcd\x8f\xa9\x32\x8f\x4f\x94\x10\x7d\x96\x9c\xb9\x53\xdb\x9f\xa5\xf8\xdc\xd6\x89\x65\x5d\x26\x57\x15\xbd\x4e\x74\x4d\xb9\xfb\x9a\x27\x9a\x4f\x56\x19\x25\x3f\xa7\xc4\xb8\x4a\x20\x0d\x37\x13\xff\x00\xb5\xfc\x34\xe2\x2f\x71\x41\x83\xa7\x75\xde\xd5\xcd\x38\xac\x44\x31\xbb\x53\xbe\x59\x01\x0e\x4f\x1d\xf8\xd1\xbd\xca\xc7\x6d\x23\x51\xaf\x3a\x7f\x46\x9f\x7b\xb4\x59\x7a\x07\xfd\x66\xee\xf7\xf3\x42\xcb\xf5\x45\xbc\xde\xe3\xd6\x6e\x62\xa8\x50\x9e\x7f\x45\xd9\x2d\x42\x5d\xbf\x9f\x4e\xdf\x4e\xb7\x6e\xe3\xde\x3d\xef\x68\x7e\x76\x6e\x74\x91\x18\x5b\x2e\x20\xf6\x47\x38\x07\xdd\x98\xa9\xbb\x2c\x13\xae\x45\x6d\xd7\xfa\x2d\x00\x00\xff\xff\xce\x6a\x57\xb9\xc9\x1a\x00\x00"), }, "/main.tmpl": &vfsgen۰CompressedFileInfo{ name: "main.tmpl", @@ -168,6 +168,20 @@ var Assets = func() http.FileSystem { compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x91\xcd\xae\xda\x30\x10\x85\xd7\xd7\x4f\x71\x94\xcd\x85\x4a\x38\x7b\xb6\xc0\x82\x2e\xa0\x2a\xa9\xd4\x25\x26\x9e\x44\x69\xfd\x13\x39\x8e\x04\xb2\xfc\xee\x95\xed\x14\x5a\x55\x55\xbb\x3b\xe3\xf9\xf2\xc5\x33\xae\x6b\xec\xac\x24\xf4\x64\xc8\x09\x4f\x12\xb7\x07\xa4\x55\xb8\xcd\x83\x92\x1c\xfb\x33\x4e\xe7\x06\x87\xfd\xb1\xe1\xac\xae\x31\xd9\xd9\xb5\xb4\x85\x98\xbd\xe5\xbd\x65\x6c\x14\xed\x77\xd1\x13\xb4\x95\xa4\x18\x0b\x81\x37\xe2\xa6\x88\x1f\xf5\x68\x9d\xc7\x52\x7d\x2a\xd4\x14\x23\x4b\x96\x27\xd5\xd8\x2f\xe3\x48\x6e\x27\x26\xfa\x89\x9e\x84\xa6\x18\x21\xa9\x1b\x0c\xc9\x17\xba\xa7\xa9\x8d\x11\xcc\x3f\x46\xfa\x1f\xc1\xe4\xdd\xdc\x7a\x04\xf6\x16\xc2\x06\x4e\x98\xfe\x49\xec\xac\x9a\xb5\x49\x97\x79\x2b\x97\x29\xee\x44\xfe\x2e\x5c\x54\x21\xf0\xcb\x67\xea\xc0\x9b\xc7\x98\xea\xeb\xdd\x3a\xbd\xad\x42\xe0\x5f\xad\xd3\x31\xe2\x3d\x84\x85\x7d\xaf\xf0\x6d\xb2\x26\x35\x37\x18\x3a\x18\x02\xff\x78\x39\x9f\x50\x55\x31\x86\x90\x73\x0a\x1b\x90\x9a\x28\x1f\x95\x0f\xf3\x91\x91\x31\x56\xb8\x6b\x95\xe5\xa5\xf1\xab\xe9\x70\x17\x7a\x54\x94\x65\xa0\x52\x64\x74\x69\x2c\x74\xf6\x5c\xcb\xe0\x39\xb3\xb2\xf6\x3c\x7d\xb2\xc2\xa7\x04\x93\xa2\xed\xfe\xdc\xf5\x5f\xb7\xca\xba\xd9\xb4\x58\x69\x7c\xf8\x37\xbb\x7e\xfd\x6f\xb5\x4e\xcf\x31\x98\x3e\x3d\x87\x23\x3f\x3b\x83\xea\x69\x58\xe6\x64\xf1\x47\x00\x00\x00\xff\xff\xb7\xef\x14\xd3\x8d\x02\x00\x00"), }, + "/proto.tmpl": &vfsgen۰CompressedFileInfo{ + name: "proto.tmpl", + modTime: time.Date(2020, 7, 1, 7, 29, 42, 453452869, time.UTC), + uncompressedSize: 560, + + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x50\xcd\x4e\x02\x31\x10\xbe\xf7\x29\xbe\x70\xd2\x44\xbb\x07\x6f\x12\x0f\x86\x83\x37\x25\x80\x0f\x50\xb6\xb3\xa4\xb1\xb4\x75\xda\x55\x9a\xa6\xef\x6e\x76\x21\x08\x06\x8d\xd7\xef\x7f\xa6\x69\x30\xf3\x9a\xb0\x21\x47\xac\x12\x69\xac\x33\xb4\xb7\x58\xf7\xc6\x6a\x89\x17\x67\x33\x9e\x0e\xe4\xc0\x25\xef\x6d\x84\xe9\xe0\x7c\x02\xed\x4c\x4c\xa4\x6f\x90\x7d\xcf\x68\x95\x03\xd3\x27\x9b\x44\x08\x56\xa5\xce\xf3\x56\x3e\x86\x00\x4d\x9d\xea\x6d\x82\x6a\x93\xf1\x4e\x34\x0d\xa2\xef\xb9\xa5\x7b\x08\x11\xb3\x4b\x6a\x87\x07\x4c\x02\xfb\xe4\xef\x26\x53\x21\x82\x6a\xdf\xd4\x86\x30\x22\x53\x31\x18\x4a\x91\x4b\xe2\x0f\xd3\x92\x5c\xf9\xd7\x10\x88\x67\x2a\x12\x8e\xe0\xb3\xda\x52\xad\x43\x93\x71\xa4\x45\xdc\xc3\xff\xb5\x15\x51\xca\x2d\x58\xb9\xcd\x09\xb7\x98\xcf\x96\xb5\x0a\x80\x43\x3b\x04\x9d\x05\x1c\x8c\x57\xa5\xc8\xf9\x82\x3a\xc8\x05\xbd\xf7\x14\x93\x5c\xe5\x40\xb5\x5e\x83\x29\xf5\xec\xe2\x99\x22\xd8\x7c\xe4\x4b\x1d\x3b\xc9\xe9\x5a\x45\x15\xa2\x94\xcb\xf5\xfb\xdb\x2f\x75\x1c\x8f\xdd\x52\x8c\xc3\xbb\x7e\xd3\x95\x9f\x29\xdf\x3b\xfe\xca\x38\x51\x8d\x63\xc7\xa9\x5f\x01\x00\x00\xff\xff\xec\xc4\x24\xfb\x30\x02\x00\x00"), + }, + "/rpc.tmpl": &vfsgen۰CompressedFileInfo{ + name: "rpc.tmpl", + modTime: time.Date(2020, 7, 1, 7, 49, 46, 50140548, time.UTC), + uncompressedSize: 474, + + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x90\x4d\x6a\xc3\x30\x10\x85\xd7\x99\x53\x0c\x26\x14\x27\x04\xe9\x10\xd9\x97\xe0\xa4\x07\x10\xf2\xd8\x98\x3a\x92\x3a\x1e\x17\x9b\x41\x77\x2f\x8d\x4d\x69\xd3\x1f\xba\x12\xe8\x3d\x7d\x1f\x7a\xc9\xf9\x67\xd7\x12\x72\xf2\x00\xdd\x35\x45\x16\x2c\x01\x11\xb1\x50\x35\xa7\x25\x7d\x74\x57\xca\xd9\x72\xf2\x36\x71\x94\x58\x00\x6c\x8a\x36\xf6\x2e\xb4\x26\x72\x6b\x27\x1b\x48\xac\x8f\x41\x68\x92\x02\x76\x00\xd6\xa2\xaa\x39\x13\xbf\x76\x9e\xcc\x25\x3e\xa5\x44\x7c\x74\x03\xe1\xc7\xe5\x02\xc5\x9a\x9a\x2e\x50\x0d\x32\x27\xfa\xef\x9b\x41\x78\xf4\xa2\x19\x40\x95\x5d\x68\x3f\x35\xaa\xd3\xf1\x9c\xf3\xea\xff\xc2\xb8\xf3\x35\x63\xf0\x58\x0e\xb8\x57\xdd\xfe\x28\xdd\xde\x59\x77\xbf\x10\x4b\x2f\x13\xae\x7f\x37\xc7\xe5\x3c\x60\x17\x70\x7f\xdb\xca\xbc\xcf\x58\x51\x83\xa6\xa2\x97\x91\x06\x31\x97\x39\xdd\x70\xe5\xf7\x42\xea\xe7\x35\x3e\x20\x31\x47\xde\xa1\xc2\x86\x49\x46\x0e\xf8\xf0\x47\x5d\xf3\x01\x43\xd7\x43\x06\x55\x0a\x75\xce\x00\x6f\x01\x00\x00\xff\xff\x7a\x4d\xb8\x53\xda\x01\x00\x00"), + }, "/select.tmpl": &vfsgen۰CompressedFileInfo{ name: "select.tmpl", modTime: time.Date(2020, 6, 13, 2, 46, 6, 616852768, time.UTC), @@ -245,6 +259,8 @@ var Assets = func() http.FileSystem { fs["/ctr.tmpl"].(os.FileInfo), fs["/main.tmpl"].(os.FileInfo), fs["/model.tmpl"].(os.FileInfo), + fs["/proto.tmpl"].(os.FileInfo), + fs["/rpc.tmpl"].(os.FileInfo), fs["/select.tmpl"].(os.FileInfo), fs["/sql.tmpl"].(os.FileInfo), fs["/sqlmap.tmpl"].(os.FileInfo), diff --git a/cmd/dolphin/gen/template/assets/auto.tmpl b/cmd/dolphin/gen/template/assets/auto.tmpl index d0d7db0b..ec923b4e 100644 --- a/cmd/dolphin/gen/template/assets/auto.tmpl +++ b/cmd/dolphin/gen/template/assets/auto.tmpl @@ -8,6 +8,8 @@ import ( "{{.PackageName}}/model" "github.com/2637309949/dolphin/packages/viper" + "github.com/2637309949/dolphin/packages/logrus" + "github.com/2637309949/dolphin/platform/util" ) // Name project @@ -46,8 +48,16 @@ func {{.ToUpperCase .Name}}Routes(engine *Engine) { var {{.ToUpperCase .Name}}Instance = New{{.ToUpperCase .Name}}() {{end}} -// SyncModels defined -func SyncModels() error { + +{{- range .Services}} +// {{.ToUpperCase .Name}} defined +func {{.ToUpperCase .Name}}Service(engine *Engine) { + proto.Register{{.ToUpperCase .Name}}Server(engine.GRPC, &rpc.{{.ToUpperCase .Name}}{}) +} +{{- end}} + +// SyncModel defined +func SyncModel() error { mseti := App.Manager.MSet() {{- range .Tables}} mseti.Add(new(model.{{.ToUpperCase .Name}}){{- if ne .Bind "" }}, "{{.Bind}}"{{- end}}) @@ -63,34 +73,16 @@ func SyncCtr() error { return nil } -// Executor defined -type Executor []func() error - -// Add defined -func (act *Executor) Add(i ...func() error) *Executor { - *act = append(*act, i...) - return act -} - -// Execute defined -func (act *Executor) Execute() error { - for _, v := range *act { - if err := v(); err != nil { - return err - } - } +// SyncService defined +func SyncService() error { + {{- range .Services}} + {{.ToUpperCase .Name}}Service(App) + {{- end}} return nil } -// NewExecutor defined -func NewExecutor(i ...func() error) *Executor { - e := &Executor{} - e.Add(i...) - return e -} - // ExecutorInstance defined -var ExecutorInstance = NewExecutor(SyncModels, SyncCtr) +var ExecutorInstance = util.NewExecutor(SyncModel, SyncCtr, SyncService) func init() { if err := ExecutorInstance.Execute(); err != nil { diff --git a/cmd/dolphin/gen/template/assets/proto.tmpl b/cmd/dolphin/gen/template/assets/proto.tmpl new file mode 100644 index 00000000..e79b45fe --- /dev/null +++ b/cmd/dolphin/gen/template/assets/proto.tmpl @@ -0,0 +1,20 @@ +// Code generated by dol build. Only Generate by tools if not existed, your can rewrite platform.App default action +// source: + +syntax = "proto3"; + +package proto; + +// {{.Service.ToUpperCase .Service.Name}} defined +service {{.Service.ToUpperCase .Service.Name}} { +{{- range .Service.RPCS}} + rpc {{.ToUpperCase .Name}} ({{.PRef .Request.Type}}) returns ({{.PRef .Reply.Type}}) {} +{{- end}} +} + +{{range .Service.RPCS}} +// {{.PRef .Request.Type}} defined +message {{.PRef .Request.Type}} {} +// {{.PRef .Reply.Type}} defined +message {{.PRef .Reply.Type}} {} +{{end}} \ No newline at end of file diff --git a/cmd/dolphin/gen/template/assets/rpc.tmpl b/cmd/dolphin/gen/template/assets/rpc.tmpl new file mode 100644 index 00000000..804baf6e --- /dev/null +++ b/cmd/dolphin/gen/template/assets/rpc.tmpl @@ -0,0 +1,18 @@ +package rpc + +import ( + "{{.PackageName}}/rpc/proto" + + "golang.org/x/net/context" +) + +// {{.Service.ToUpperCase .Service.Name}} defined +type {{.Service.ToUpperCase .Service.Name}} struct{} + +{{range .Service.RPCS}} +// {{.ToUpperCase .Name}} defined +func (s *{{$.Service.ToUpperCase $.Service.Name}}) {{.ToUpperCase .Name}}(ctx context.Context, in *proto.{{.PRef .Request.Type}}) (*proto.{{.PRef .Reply.Type}}, error) { + return &proto.{{.PRef .Reply.Type}}{}, nil +} +{{end}} + diff --git a/cmd/dolphin/main.go b/cmd/dolphin/main.go index 9dfa6e1e..72967aef 100644 --- a/cmd/dolphin/main.go +++ b/cmd/dolphin/main.go @@ -53,6 +53,7 @@ func InitViper(cmd *cobra.Command, args []string) { viper.SetDefault("dir.util", "util") viper.SetDefault("dir.model", "model") viper.SetDefault("dir.srv", "srv") + viper.SetDefault("dir.rpc", "rpc") viper.SetDefault("swag.license.name", "Apache 2.0") viper.SetDefault("swag.license.url", "http://www.apache.org/licenses/LICENSE-2.0.html") viper.SetDefault("swag.securitydefinitions.oauth2.accessCode", "OAuth2AccessCode") @@ -96,7 +97,7 @@ var ( if err := p.Walk(wd); err != nil { return err } - pipes := append(args, "main", "app", "ctr", "srv", "model", "bean", "auto", "tool", "sql", "sqlmap", "oauth", "script", "doc") + pipes := append(args, "main", "app", "ctr", "proto", "srv", "model", "bean", "auto", "tool", "sql", "sqlmap", "oauth", "script", "doc") g := gen.New(p.Application) g.AddPipe(gen.GetPipesByName(pipes...)...) err = g.BuildWithDir(wd) diff --git a/cmd/dolphin/parser/parser.go b/cmd/dolphin/parser/parser.go index 5d1ab83a..152e7d82 100644 --- a/cmd/dolphin/parser/parser.go +++ b/cmd/dolphin/parser/parser.go @@ -149,6 +149,75 @@ func (parser *AppParser) parseParam(xmlPath string, attr []xml.Attr) *schema.Par return param } +func (parser *AppParser) parseService(xmlPath string, attr []xml.Attr) *schema.Service { + service := &schema.Service{} + service.Path = xmlPath + for _, attr := range attr { + attrName := attr.Name.Local + attrValue := attr.Value + if strings.TrimSpace(attrValue) == "" { + continue + } + switch true { + case attrName == "name": + service.Name = attrValue + case attrName == "desc": + service.Desc = attrValue + } + } + return service +} + +func (parser *AppParser) parseRPC(xmlPath string, attr []xml.Attr) *schema.RPC { + rpc := &schema.RPC{Request: &schema.Request{}, Reply: &schema.Reply{}} + for _, attr := range attr { + attrName := attr.Name.Local + attrValue := attr.Value + if strings.TrimSpace(attrValue) == "" { + continue + } + switch true { + case attrName == "name": + rpc.Name = attrValue + case attrName == "desc": + rpc.Desc = attrValue + } + } + return rpc +} + +func (parser *AppParser) parseRequest(xmlPath string, attr []xml.Attr, rpc *schema.RPC) { + for _, attr := range attr { + attrName := attr.Name.Local + attrValue := attr.Value + if strings.TrimSpace(attrValue) == "" { + continue + } + switch true { + case attrName == "desc": + rpc.Request.Desc = attrValue + case attrName == "type": + rpc.Request.Type = attrValue + } + } +} + +func (parser *AppParser) parseReply(xmlPath string, attr []xml.Attr, rpc *schema.RPC) { + for _, attr := range attr { + attrName := attr.Name.Local + attrValue := attr.Value + if strings.TrimSpace(attrValue) == "" { + continue + } + switch true { + case attrName == "desc": + rpc.Reply.Desc = attrValue + case attrName == "type": + rpc.Reply.Type = attrValue + } + } +} + func (parser *AppParser) parseBean(xmlPath string, attr []xml.Attr) *schema.Bean { bean := &schema.Bean{} bean.Path = xmlPath diff --git a/cmd/dolphin/parser/xml.go b/cmd/dolphin/parser/xml.go index 17e07129..7ab8be55 100644 --- a/cmd/dolphin/parser/xml.go +++ b/cmd/dolphin/parser/xml.go @@ -57,6 +57,9 @@ func (parser *AppParser) parse(xmlPath string) error { var prop *schema.Prop var table *schema.Table var column *schema.Column + + var service *schema.Service + var rpc *schema.RPC for t, err := decoder.Token(); err == nil; t, err = decoder.Token() { switch token := t.(type) { case xml.StartElement: @@ -73,6 +76,14 @@ func (parser *AppParser) parse(xmlPath string) error { parser.parseFailure(xmlPath, token.Attr, api) case token.Name.Local == "param": param = parser.parseParam(xmlPath, token.Attr) + case token.Name.Local == "service": + service = parser.parseService(xmlPath, token.Attr) + case token.Name.Local == "rpc": + rpc = parser.parseRPC(xmlPath, token.Attr) + case token.Name.Local == "request": + parser.parseRequest(xmlPath, token.Attr, rpc) + case token.Name.Local == "reply": + parser.parseReply(xmlPath, token.Attr, rpc) case token.Name.Local == "bean": bean = parser.parseBean(xmlPath, token.Attr) case token.Name.Local == "prop": @@ -88,6 +99,10 @@ func (parser *AppParser) parse(xmlPath string) error { parser.Application.Controllers = append(parser.Application.Controllers, controller) case token.Name.Local == "api": controller.APIS = append(controller.APIS, api) + case token.Name.Local == "service": + parser.Application.Services = append(parser.Application.Services, service) + case token.Name.Local == "rpc": + service.RPCS = append(service.RPCS, rpc) case token.Name.Local == "param": api.Params = append(api.Params, param) case token.Name.Local == "bean": diff --git a/cmd/dolphin/schema/common.go b/cmd/dolphin/schema/common.go index 2d8d8896..ee95a616 100644 --- a/cmd/dolphin/schema/common.go +++ b/cmd/dolphin/schema/common.go @@ -209,7 +209,15 @@ func (c *Common) Ref(m string) string { } return fmt.Sprintf("model.%v", c.ToUpperCase(m)) } - return m + return c.ToUpperCase(m) +} + +// PRef defined model name +func (c *Common) PRef(m string) string { + if strings.HasPrefix(m, "$") { + return fmt.Sprintf("%v", c.ToUpperCase(strings.ReplaceAll(m, "$", ""))) + } + return c.ToUpperCase(m) } // SRef defined model name diff --git a/cmd/dolphin/schema/schema.go b/cmd/dolphin/schema/schema.go index fc258d3d..867d2dcf 100644 --- a/cmd/dolphin/schema/schema.go +++ b/cmd/dolphin/schema/schema.go @@ -45,13 +45,38 @@ type API struct { Return *Return } -// Controller struct +// Controller deifned type Controller struct { Common APIS []*API Prefix string } +// Service defined +type Service struct { + Common + RPCS []*RPC +} + +// RPC defined +type RPC struct { + Common + Request *Request + Reply *Reply +} + +// Request defined +type Request struct { + Common + Type string +} + +// Reply defined +type Reply struct { + Common + Type string +} + // Prop struct type Prop struct { Common @@ -91,6 +116,7 @@ type Application struct { Common PackageName string `validate:"required"` Controllers []*Controller + Services []*Service Beans []*Bean Tables []*Table } diff --git a/demo/.gitignore b/demo/.gitignore index 041be934..946b18cc 100644 --- a/demo/.gitignore +++ b/demo/.gitignore @@ -22,6 +22,7 @@ log # Auto code generated by dol build **.*go.new +**.*proto.new # Dependency directories (remove the comment below to include it) vendor \ No newline at end of file diff --git a/demo/doc/swagger.yaml b/demo/doc/swagger.yaml index fbb00883..b0bad2c5 100644 --- a/demo/doc/swagger.yaml +++ b/demo/doc/swagger.yaml @@ -227,7 +227,8 @@ definitions: description: 最后更新时间 type: string url: - description: 菜单URL,类型:1.普通页面(如用户管理, /sys/user) 2.嵌套完整外部页面,以http(s)开头的链接 3.嵌套服务器页面,使用iframe:前缀+目标URL(如SQL监控, iframe:/druid/login.html, iframe:前缀会替换成服务器地址) + description: 菜单URL,类型:1.普通页面(如用户管理, /sys/user) 2.嵌套完整外部页面,以http(s)开头的链接 3.嵌套服务器页面,使用iframe:前缀+目标URL(如SQL监控, + iframe:/druid/login.html, iframe:前缀会替换成服务器地址) type: string type: object model.SysArea: @@ -521,7 +522,8 @@ definitions: description: 最后更新时间 type: string url: - description: 菜单URL,类型:1.普通页面(如用户管理, /sys/user) 2.嵌套完整外部页面,以http(s)开头的链接 3.嵌套服务器页面,使用iframe:前缀+目标URL(如SQL监控, iframe:/druid/login.html, iframe:前缀会替换成服务器地址) + description: 菜单URL,类型:1.普通页面(如用户管理, /sys/user) 2.嵌套完整外部页面,以http(s)开头的链接 3.嵌套服务器页面,使用iframe:前缀+目标URL(如SQL监控, + iframe:/druid/login.html, iframe:前缀会替换成服务器地址) type: string type: object model.SysNotification: diff --git a/demo/go.mod b/demo/go.mod index c87363e5..bede5a3d 100644 --- a/demo/go.mod +++ b/demo/go.mod @@ -7,4 +7,7 @@ replace github.com/2637309949/dolphin => ../ require ( github.com/2637309949/dolphin v0.0.0-20200627033829-7bdf41305cd2 github.com/go-sql-driver/mysql v1.5.0 + github.com/golang/protobuf v1.3.2 + golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 + google.golang.org/grpc v1.26.0 ) diff --git a/demo/rpc/message.go b/demo/rpc/message.go new file mode 100755 index 00000000..dd7c32f3 --- /dev/null +++ b/demo/rpc/message.go @@ -0,0 +1,15 @@ +package rpc + +import ( + "demo/rpc/proto" + + "golang.org/x/net/context" +) + +// Message defined +type Message struct{} + +// SendMail defined +func (s *Message) SendMail(ctx context.Context, in *proto.Article) (*proto.Success, error) { + return &proto.Success{}, nil +} diff --git a/demo/rpc/proto/message.pb.go b/demo/rpc/proto/message.pb.go new file mode 100644 index 00000000..21f7459a --- /dev/null +++ b/demo/rpc/proto/message.pb.go @@ -0,0 +1,187 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: message.proto + +package proto + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Article defined +type Article struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Article) Reset() { *m = Article{} } +func (m *Article) String() string { return proto.CompactTextString(m) } +func (*Article) ProtoMessage() {} +func (*Article) Descriptor() ([]byte, []int) { + return fileDescriptor_33c57e4bae7b9afd, []int{0} +} + +func (m *Article) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Article.Unmarshal(m, b) +} +func (m *Article) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Article.Marshal(b, m, deterministic) +} +func (m *Article) XXX_Merge(src proto.Message) { + xxx_messageInfo_Article.Merge(m, src) +} +func (m *Article) XXX_Size() int { + return xxx_messageInfo_Article.Size(m) +} +func (m *Article) XXX_DiscardUnknown() { + xxx_messageInfo_Article.DiscardUnknown(m) +} + +var xxx_messageInfo_Article proto.InternalMessageInfo + +// Success defined +type Success struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Success) Reset() { *m = Success{} } +func (m *Success) String() string { return proto.CompactTextString(m) } +func (*Success) ProtoMessage() {} +func (*Success) Descriptor() ([]byte, []int) { + return fileDescriptor_33c57e4bae7b9afd, []int{1} +} + +func (m *Success) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Success.Unmarshal(m, b) +} +func (m *Success) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Success.Marshal(b, m, deterministic) +} +func (m *Success) XXX_Merge(src proto.Message) { + xxx_messageInfo_Success.Merge(m, src) +} +func (m *Success) XXX_Size() int { + return xxx_messageInfo_Success.Size(m) +} +func (m *Success) XXX_DiscardUnknown() { + xxx_messageInfo_Success.DiscardUnknown(m) +} + +var xxx_messageInfo_Success proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Article)(nil), "proto.Article") + proto.RegisterType((*Success)(nil), "proto.Success") +} + +func init() { proto.RegisterFile("message.proto", fileDescriptor_33c57e4bae7b9afd) } + +var fileDescriptor_33c57e4bae7b9afd = []byte{ + // 100 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcd, 0x4d, 0x2d, 0x2e, + 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x53, 0x4a, 0x9c, 0x5c, + 0xec, 0x8e, 0x45, 0x25, 0x99, 0xc9, 0x39, 0xa9, 0x20, 0x66, 0x70, 0x69, 0x72, 0x72, 0x6a, 0x71, + 0xb1, 0x91, 0x39, 0x17, 0xbb, 0x2f, 0x44, 0xb5, 0x90, 0x0e, 0x17, 0x47, 0x70, 0x6a, 0x5e, 0x8a, + 0x6f, 0x62, 0x66, 0x8e, 0x10, 0x1f, 0x44, 0xaf, 0x1e, 0x54, 0x87, 0x14, 0x8c, 0x0f, 0xd5, 0xa6, + 0xc4, 0x90, 0xc4, 0x06, 0x16, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xb9, 0x50, 0x63, 0x6e, + 0x6d, 0x00, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MessageClient is the client API for Message service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MessageClient interface { + SendMail(ctx context.Context, in *Article, opts ...grpc.CallOption) (*Success, error) +} + +type messageClient struct { + cc *grpc.ClientConn +} + +func NewMessageClient(cc *grpc.ClientConn) MessageClient { + return &messageClient{cc} +} + +func (c *messageClient) SendMail(ctx context.Context, in *Article, opts ...grpc.CallOption) (*Success, error) { + out := new(Success) + err := c.cc.Invoke(ctx, "/proto.Message/SendMail", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MessageServer is the server API for Message service. +type MessageServer interface { + SendMail(context.Context, *Article) (*Success, error) +} + +// UnimplementedMessageServer can be embedded to have forward compatible implementations. +type UnimplementedMessageServer struct { +} + +func (*UnimplementedMessageServer) SendMail(ctx context.Context, req *Article) (*Success, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendMail not implemented") +} + +func RegisterMessageServer(s *grpc.Server, srv MessageServer) { + s.RegisterService(&_Message_serviceDesc, srv) +} + +func _Message_SendMail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Article) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MessageServer).SendMail(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto.Message/SendMail", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MessageServer).SendMail(ctx, req.(*Article)) + } + return interceptor(ctx, in, info, handler) +} + +var _Message_serviceDesc = grpc.ServiceDesc{ + ServiceName: "proto.Message", + HandlerType: (*MessageServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SendMail", + Handler: _Message_SendMail_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "message.proto", +} diff --git a/demo/rpc/proto/message.proto b/demo/rpc/proto/message.proto new file mode 100755 index 00000000..461a855b --- /dev/null +++ b/demo/rpc/proto/message.proto @@ -0,0 +1,17 @@ +// Code generated by dol build. Only Generate by tools if not existed, your can rewrite platform.App default action +// source: + +syntax = "proto3"; + +package proto; + +// Message service definition. +service Message { + rpc SendMail (Article) returns (Success) {} +} + + +// Article defined +message Article {} +// Success defined +message Success {} diff --git a/demo/script/apis/article.js b/demo/script/apis/article.js index 9134c978..1dc220fb 100755 --- a/demo/script/apis/article.js +++ b/demo/script/apis/article.js @@ -1,5 +1,4 @@ // Code generated by dol build. DO NOT EDIT. -// source: auto.go const axios = require('@/utils/request').default // add 添加文章 diff --git a/demo/script/apis/index.js b/demo/script/apis/index.js index 02c89c11..4f8d1639 100755 --- a/demo/script/apis/index.js +++ b/demo/script/apis/index.js @@ -1,4 +1,3 @@ // Code generated by dol build. DO NOT EDIT. -// source: auto.go // article 文章 module.exports.article = require('./article') \ No newline at end of file diff --git a/demo/xml/rpc/message.xml b/demo/xml/rpc/message.xml new file mode 100644 index 00000000..c39655a8 --- /dev/null +++ b/demo/xml/rpc/message.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/platform/app/app.auto.go b/platform/app/app.auto.go index a7bdf600..8bcebde7 100755 --- a/platform/app/app.auto.go +++ b/platform/app/app.auto.go @@ -5,7 +5,7 @@ package app import ( "github.com/2637309949/dolphin/platform/model" - + "github.com/2637309949/dolphin/platform/util" "github.com/2637309949/dolphin/packages/logrus" "github.com/2637309949/dolphin/packages/viper" ) @@ -751,25 +751,6 @@ func SysWorkerRoutes(engine *Engine) { // SysWorkerInstance defined var SysWorkerInstance = NewSysWorker() -// Executor defined -type Executor []func() error - -// Add defined -func (act *Executor) Add(i func() error) *Executor { - *act = append(*act, i) - return act -} - -// Execute defined -func (act *Executor) Execute() error { - for _, v := range *act { - if err := v(); err != nil { - return err - } - } - return nil -} - // SyncModels defined func SyncModels() error { mseti := App.Manager.MSet() @@ -833,7 +814,7 @@ func SyncCtr() error { } // ExecutorInstance defined -var ExecutorInstance = &Executor{ +var ExecutorInstance = &util.Executor{ SyncModels, SyncCtr, } diff --git a/platform/conf/properties.go b/platform/conf/properties.go index cc7292d5..7d913220 100644 --- a/platform/conf/properties.go +++ b/platform/conf/properties.go @@ -39,6 +39,7 @@ func init() { viper.SetDefault("dir.util", "util") viper.SetDefault("dir.model", "model") viper.SetDefault("dir.srv", "srv") + viper.SetDefault("dir.rpc", "rpc") viper.SetDefault("swag.license.name", "Apache 2.0") viper.SetDefault("swag.license.url", "http://www.apache.org/licenses/LICENSE-2.0.html") viper.SetDefault("swag.securitydefinitions.oauth2.accessCode", "OAuth2AccessCode") diff --git a/platform/util/executor.go b/platform/util/executor.go new file mode 100644 index 00000000..1ed53a27 --- /dev/null +++ b/platform/util/executor.go @@ -0,0 +1,27 @@ +package util + +// Executor defined +type Executor []func() error + +// Add defined +func (act *Executor) Add(i ...func() error) *Executor { + *act = append(*act, i...) + return act +} + +// Execute defined +func (act *Executor) Execute() error { + for _, v := range *act { + if err := v(); err != nil { + return err + } + } + return nil +} + +// NewExecutor defined +func NewExecutor(i ...func() error) *Executor { + e := &Executor{} + e.Add(i...) + return e +}