From c04ddac5b5c765516504f5b3910371ceb57301a9 Mon Sep 17 00:00:00 2001 From: guihouchang Date: Tue, 14 Mar 2023 15:48:21 +0800 Subject: [PATCH] =?UTF-8?q?#=20feat(pb):=20=E6=96=B0=E5=A2=9EUnimplemented?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E4=BD=93=EF=BC=8C=E5=AE=9E=E7=8E=B0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=97=B6=E5=8F=AA=E8=A6=81=E5=86=85=E5=B5=8C=E8=AF=A5?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E4=BD=93=E5=8D=B3=E5=8F=AF=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=AE=9E=E7=8E=B0=E6=89=80=E6=9C=89=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/template.go b/template.go index 8626266..e5f144a 100644 --- a/template.go +++ b/template.go @@ -13,6 +13,7 @@ type {{.ServiceType}}EventServer interface { {{- range .MethodSets}} {{.Name}}(context.Context, *{{.Request}}) error {{- end}} +mustEmbedUnimplemented{{.ServiceType}}EventServer() } func Register{{.ServiceType}}EventServer(r *message.Router, sg func(topic string) message.Subscriber, srv {{.ServiceType}}EventServer) { @@ -73,6 +74,7 @@ func (c *{{$svrType}}EventClientImpl) {{.Name}}(ctx context.Context, req *{{.Req return c.publisher.Publish(topic, msg) } {{end}} + {{range .MethodSets}} {{if gt .EventDelay 0}} func (c *{{$svrType}}EventClientImpl) {{.Name}}WithDelay(ctx context.Context, req *{{.Request}}, delay uint64) error { @@ -89,6 +91,18 @@ func (c *{{$svrType}}EventClientImpl) {{.Name}}WithDelay(ctx context.Context, re } {{end}} {{end}} + +type Unsafe{{.ServiceType}}EventServer interface { + mustEmbedUnimplemented{{.ServiceType}}EventServer() +} +type Unimplemented{{.ServiceType}}EventServer struct {} + +{{- range .MethodSets}} +func (Unimplemented{{$svrType}}EventServer) {{.Name}}(context.Context, *{{.Request}}) error { + return nil +} +{{- end}} + ` type serviceDesc struct {