regen and update

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-06-30 17:53:06 +03:00
parent 14d062b4a5
commit 3ceff22f52
28 changed files with 1333 additions and 60 deletions

View File

@ -1,3 +1,3 @@
package grpc package grpc
//go:generate protoc -I./proto -I. --go-grpc_out=paths=source_relative:./proto --go_out=paths=source_relative:./proto --micro_out=components=micro|rpc,standalone=true,paths=source_relative:./gproto proto/test.proto //go:generate protoc -I./proto -I. --go-grpc_out=paths=source_relative:./proto --go_out=paths=source_relative:./proto --go-micro_out=components=micro|rpc,standalone=true,paths=source_relative:./gproto proto/test.proto

View File

@ -1,5 +1,7 @@
// Code generated by protoc-gen-micro // Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.4.0
// source: test.proto // source: test.proto
package helloworld package helloworld
import ( import (
@ -9,8 +11,12 @@ import (
client "github.com/unistack-org/micro/v3/client" client "github.com/unistack-org/micro/v3/client"
) )
func NewTestEndpoints() []*api.Endpoint { var (
return []*api.Endpoint{} TestEndpoints = []api.Endpoint{}
)
func NewTestEndpoints() []api.Endpoint {
return TestEndpoints
} }
type TestClient interface { type TestClient interface {

View File

@ -1,5 +1,7 @@
// Code generated by protoc-gen-micro // Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.4.0
// source: test.proto // source: test.proto
package helloworld package helloworld
import ( import (
@ -122,8 +124,8 @@ func RegisterTestServer(s server.Server, sh TestServer, opts ...server.HandlerOp
} }
h := &testServer{sh} h := &testServer{sh}
var nopts []server.HandlerOption var nopts []server.HandlerOption
for _, endpoint := range NewTestEndpoints() { for _, endpoint := range TestEndpoints {
nopts = append(nopts, api.WithEndpoint(endpoint)) nopts = append(nopts, api.WithEndpoint(&endpoint))
} }
return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...)) return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...))
} }

View File

@ -1,3 +1,3 @@
package http package http
//go:generate protoc -I./proto -I. -I/home/vtolstov/.cache/go-path/pkg/mod/github.com/unistack-org/micro-proto@v0.0.1 --go_out=paths=source_relative:./proto --micro_out=components=micro|http,debug=true,paths=source_relative:./proto proto/github.proto //go:generate protoc -I./proto -I. -I/home/vtolstov/.cache/go-path/pkg/mod/github.com/unistack-org/micro-proto@v0.0.1 --go_out=paths=source_relative:./proto --go-micro_out=components=micro|http,debug=true,paths=source_relative:./proto proto/github.proto

View File

@ -1,5 +1,7 @@
// Code generated by protoc-gen-micro // Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.4.0
// source: github.proto // source: github.proto
package pb package pb
import ( import (
@ -8,21 +10,25 @@ import (
client "github.com/unistack-org/micro/v3/client" client "github.com/unistack-org/micro/v3/client"
) )
func NewGithubEndpoints() []*api.Endpoint { var (
return []*api.Endpoint{ GithubEndpoints = []api.Endpoint{
&api.Endpoint{ api.Endpoint{
Name: "Github.LookupUser", Name: "Github.LookupUser",
Path: []string{"/users/{username}"}, Path: []string{"/users/{username}"},
Method: []string{"GET"}, Method: []string{"GET"},
Handler: "rpc", Handler: "rpc",
}, },
&api.Endpoint{ api.Endpoint{
Name: "Github.LookupUserWithoutPath", Name: "Github.LookupUserWithoutPath",
Path: []string{"/{username}"}, Path: []string{"/{username}"},
Method: []string{"GET"}, Method: []string{"GET"},
Handler: "rpc", Handler: "rpc",
}, },
} }
)
func NewGithubEndpoints() []api.Endpoint {
return GithubEndpoints
} }
type GithubClient interface { type GithubClient interface {

View File

@ -1,5 +1,7 @@
// Code generated by protoc-gen-micro // Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.4.0
// source: github.proto // source: github.proto
package pb package pb
import ( import (
@ -78,8 +80,8 @@ func RegisterGithubServer(s server.Server, sh GithubServer, opts ...server.Handl
} }
h := &githubServer{sh} h := &githubServer{sh}
var nopts []server.HandlerOption var nopts []server.HandlerOption
for _, endpoint := range NewGithubEndpoints() { for _, endpoint := range GithubEndpoints {
nopts = append(nopts, api.WithEndpoint(endpoint)) nopts = append(nopts, api.WithEndpoint(&endpoint))
} }
return s.Handle(s.NewHandler(&Github{h}, append(nopts, opts...)...)) return s.Handle(s.NewHandler(&Github{h}, append(nopts, opts...)...))
} }

View File

@ -1,3 +1,3 @@
package codec package codec
//go:generate protoc -I./proto -I. -I/home/vtolstov/.cache/go-path/pkg/mod/github.com/unistack-org/micro/v3@v3.2.24 -I/home/vtolstov/.cache/go-path/pkg/mod/github.com/unistack-org/micro-proto@v0.0.1 --go_out=paths=source_relative:./proto --micro_out=components=micro|http,debug=true,paths=source_relative:./proto proto/test.proto //go:generate protoc -I./proto -I. -I/home/vtolstov/.cache/go-path/pkg/mod/github.com/unistack-org/micro/v3@v3.2.24 -I/home/vtolstov/.cache/go-path/pkg/mod/github.com/unistack-org/micro-proto@v0.0.1 --go_out=paths=source_relative:./proto --go-micro_out=components=micro|http,debug=true,paths=source_relative:./proto proto/test.proto

View File

@ -1,5 +1,7 @@
// Code generated by protoc-gen-micro // Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.4.0
// source: test.proto // source: test.proto
package pb package pb
import ( import (
@ -9,8 +11,12 @@ import (
codec "github.com/unistack-org/micro/v3/codec" codec "github.com/unistack-org/micro/v3/codec"
) )
func NewTestEndpoints() []*api.Endpoint { var (
return []*api.Endpoint{} TestEndpoints = []api.Endpoint{}
)
func NewTestEndpoints() []api.Endpoint {
return TestEndpoints
} }
type TestClient interface { type TestClient interface {

View File

@ -1,5 +1,7 @@
// Code generated by protoc-gen-micro // Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.4.0
// source: test.proto // source: test.proto
package pb package pb
import ( import (
@ -46,8 +48,8 @@ func RegisterTestServer(s server.Server, sh TestServer, opts ...server.HandlerOp
} }
h := &testServer{sh} h := &testServer{sh}
var nopts []server.HandlerOption var nopts []server.HandlerOption
for _, endpoint := range NewTestEndpoints() { for _, endpoint := range TestEndpoints {
nopts = append(nopts, api.WithEndpoint(endpoint)) nopts = append(nopts, api.WithEndpoint(&endpoint))
} }
return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...)) return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...))
} }

View File

@ -1,5 +1,5 @@
package grpc package grpc
//go:generate protoc -I./proto -I. -I/home/vtolstov/.cache/go-path/pkg/mod/github.com/unistack-org/micro-proto@v0.0.1 --go_out=paths=source_relative:./proto --micro_out=components=micro|http,debug=true,paths=source_relative:./proto proto/test.proto //go:generate protoc -I./proto -I. -I/home/vtolstov/.cache/go-path/pkg/mod/github.com/unistack-org/micro-proto@v0.0.1 --go_out=paths=source_relative:./proto --go-micro_out=components=micro|http,debug=true,paths=source_relative:./proto proto/test.proto
///go:generate protoc -I./proto -I. -I/home/vtolstov/devel/projects/unistack/micro/micro-proto --go_out=paths=source_relative:./proto --micro_out=components=micro|http,debug=true,paths=source_relative:./proto proto/test.proto ///go:generate protoc -I./proto -I. -I/home/vtolstov/devel/projects/unistack/micro/micro-proto --go_out=paths=source_relative:./proto --go-micro_out=components=micro|http,debug=true,paths=source_relative:./proto proto/test.proto

View File

@ -1,5 +1,7 @@
// Code generated by protoc-gen-micro // Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.4.0
// source: test.proto // source: test.proto
package pb package pb
import ( import (
@ -8,8 +10,12 @@ import (
client "github.com/unistack-org/micro/v3/client" client "github.com/unistack-org/micro/v3/client"
) )
func NewTestEndpoints() []*api.Endpoint { var (
return []*api.Endpoint{} TestEndpoints = []api.Endpoint{}
)
func NewTestEndpoints() []api.Endpoint {
return TestEndpoints
} }
type TestClient interface { type TestClient interface {

View File

@ -1,5 +1,7 @@
// Code generated by protoc-gen-micro // Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.4.0
// source: test.proto // source: test.proto
package pb package pb
import ( import (
@ -45,8 +47,8 @@ func RegisterTestServer(s server.Server, sh TestServer, opts ...server.HandlerOp
} }
h := &testServer{sh} h := &testServer{sh}
var nopts []server.HandlerOption var nopts []server.HandlerOption
for _, endpoint := range NewTestEndpoints() { for _, endpoint := range TestEndpoints {
nopts = append(nopts, api.WithEndpoint(endpoint)) nopts = append(nopts, api.WithEndpoint(&endpoint))
} }
return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...)) return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...))
} }

51
flow/flow_test.go Normal file
View File

@ -0,0 +1,51 @@
package flow
import (
"context"
"testing"
"time"
pb "github.com/unistack-org/micro-tests/client/http/proto"
"github.com/unistack-org/micro/v3/client"
"github.com/unistack-org/micro/v3/flow"
"github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/meter"
"github.com/unistack-org/micro/v3/store"
"github.com/unistack-org/micro/v3/tracer"
)
func TestFlow(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
s := store.DefaultStore
c := client.DefaultClient
m := meter.DefaultMeter
tr := tracer.DefaultTracer
l := logger.DefaultLogger
f := flow.NewFlow(flow.Context(ctx), flow.Store(s), flow.Client(c), flow.Meter(m), flow.Tracer(tr), flow.Logger(l))
if err := f.Init(); err != nil {
t.Fatal(err)
}
steps := []flow.Step{
flow.NewCallStep("test", "Github.LookupUser", flow.StepID("test.Github.LookupUser")),
flow.NewCallStep("test", "Github.UpdateUser", flow.StepRequires("test.Github.LookupUser")),
flow.NewCallStep("test", "Github.RemoveUser", flow.StepRequires("test.Github.UpdateUser")),
flow.NewCallStep("test", "Github.MailUser", flow.StepRequires("test.Github.UpdateUser")),
}
w, err := f.WorkflowCreate(ctx, "test", steps...)
if err != nil {
t.Fatal(err)
}
req := &pb.LookupUserReq{Username: "vtolstov"}
id, err := w.Execute(ctx, req, flow.ExecuteTimeout(2*time.Second))
if err != nil {
t.Fatal(err)
}
t.Logf("execution id: %s", id)
}

10
go.mod
View File

@ -12,6 +12,7 @@ require (
github.com/unistack-org/micro-api-router-register/v3 v3.2.2 github.com/unistack-org/micro-api-router-register/v3 v3.2.2
github.com/unistack-org/micro-api-router-static/v3 v3.2.1 github.com/unistack-org/micro-api-router-static/v3 v3.2.1
github.com/unistack-org/micro-broker-http/v3 v3.3.1 github.com/unistack-org/micro-broker-http/v3 v3.3.1
github.com/unistack-org/micro-client-drpc/v3 v3.0.0-00010101000000-000000000000
github.com/unistack-org/micro-client-grpc/v3 v3.3.3 github.com/unistack-org/micro-client-grpc/v3 v3.3.3
github.com/unistack-org/micro-client-http/v3 v3.3.11 github.com/unistack-org/micro-client-http/v3 v3.3.11
github.com/unistack-org/micro-codec-grpc/v3 v3.2.1 github.com/unistack-org/micro-codec-grpc/v3 v3.2.1
@ -20,6 +21,7 @@ require (
github.com/unistack-org/micro-codec-proto/v3 v3.2.2 github.com/unistack-org/micro-codec-proto/v3 v3.2.2
github.com/unistack-org/micro-codec-segmentio/v3 v3.2.2 github.com/unistack-org/micro-codec-segmentio/v3 v3.2.2
github.com/unistack-org/micro-codec-urlencode/v3 v3.0.0 github.com/unistack-org/micro-codec-urlencode/v3 v3.0.0
github.com/unistack-org/micro-codec-xml/v3 v3.2.2
github.com/unistack-org/micro-config-env/v3 v3.3.0 github.com/unistack-org/micro-config-env/v3 v3.3.0
github.com/unistack-org/micro-config-vault/v3 v3.2.9 github.com/unistack-org/micro-config-vault/v3 v3.2.9
github.com/unistack-org/micro-meter-victoriametrics/v3 v3.3.1 github.com/unistack-org/micro-meter-victoriametrics/v3 v3.3.1
@ -30,10 +32,11 @@ require (
github.com/unistack-org/micro-server-http/v3 v3.3.19 github.com/unistack-org/micro-server-http/v3 v3.3.19
github.com/unistack-org/micro-server-tcp/v3 v3.3.2 github.com/unistack-org/micro-server-tcp/v3 v3.3.2
github.com/unistack-org/micro-wrapper-trace-opentracing/v3 v3.2.0 github.com/unistack-org/micro-wrapper-trace-opentracing/v3 v3.2.0
github.com/unistack-org/micro/v3 v3.3.17 github.com/unistack-org/micro/v3 v3.4.2
google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384 google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384
google.golang.org/grpc v1.37.1 google.golang.org/grpc v1.38.0
google.golang.org/protobuf v1.26.0 google.golang.org/protobuf v1.26.0
storj.io/drpc v0.0.23
) )
//replace github.com/unistack-org/micro-wrapper-trace-opentracing/v3 => ../micro-wrapper-trace-opentracing //replace github.com/unistack-org/micro-wrapper-trace-opentracing/v3 => ../micro-wrapper-trace-opentracing
@ -41,5 +44,8 @@ require (
//replace github.com/unistack-org/micro-server-grpc/v3 => ../micro-server-grpc //replace github.com/unistack-org/micro-server-grpc/v3 => ../micro-server-grpc
//replace github.com/unistack-org/micro-server-http/v3 => ../micro-server-http //replace github.com/unistack-org/micro-server-http/v3 => ../micro-server-http
//replace github.com/unistack-org/micro-client-http/v3 => ../micro-client-http //replace github.com/unistack-org/micro-client-http/v3 => ../micro-client-http
//replace github.com/unistack-org/micro-client-drpc/v3 => ../micro-client-drpc
//replace github.com/unistack-org/micro/v3 => ../micro //replace github.com/unistack-org/micro/v3 => ../micro
//replace github.com/unistack-org/micro-proto => ../micro-proto //replace github.com/unistack-org/micro-proto => ../micro-proto

19
go.sum
View File

@ -419,6 +419,7 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg
github.com/segmentio/encoding v0.2.17 h1:cgfmPc44u1po1lz5bSgF00gLCROBjDNc7h+H7I20zpc= github.com/segmentio/encoding v0.2.17 h1:cgfmPc44u1po1lz5bSgF00gLCROBjDNc7h+H7I20zpc=
github.com/segmentio/encoding v0.2.17/go.mod h1:7E68jTSWMnNoYhHi1JbLd7NBSB6XfE4vzqhR88hDBQc= github.com/segmentio/encoding v0.2.17/go.mod h1:7E68jTSWMnNoYhHi1JbLd7NBSB6XfE4vzqhR88hDBQc=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/silas/dag v0.0.0-20210121180416-41cf55125c34 h1:vBfVmA5mZhsQa2jr1FOL9nfA37N/jnbBmi5XUfviVTI=
github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
@ -471,6 +472,8 @@ github.com/unistack-org/micro-codec-segmentio/v3 v3.2.2 h1:XJOjiANaLQRy9Uq2E5b5l
github.com/unistack-org/micro-codec-segmentio/v3 v3.2.2/go.mod h1://zU1V0mI9nSKQFzC/pjW7ARu5RzE6sRSss6sxMgeNI= github.com/unistack-org/micro-codec-segmentio/v3 v3.2.2/go.mod h1://zU1V0mI9nSKQFzC/pjW7ARu5RzE6sRSss6sxMgeNI=
github.com/unistack-org/micro-codec-urlencode/v3 v3.0.0 h1:UJDAoZmI8E4QPKOg4sFNUKDuUAWmQI3LhR5tnKn003Y= github.com/unistack-org/micro-codec-urlencode/v3 v3.0.0 h1:UJDAoZmI8E4QPKOg4sFNUKDuUAWmQI3LhR5tnKn003Y=
github.com/unistack-org/micro-codec-urlencode/v3 v3.0.0/go.mod h1:RgvI2LDxJeYPKNDvFjKvPVaaH53QBSEN2i9y4u8OOKo= github.com/unistack-org/micro-codec-urlencode/v3 v3.0.0/go.mod h1:RgvI2LDxJeYPKNDvFjKvPVaaH53QBSEN2i9y4u8OOKo=
github.com/unistack-org/micro-codec-xml/v3 v3.2.2 h1:xJMMcNjfyFNHA4bzRBrB9EvVf4GJ5Hl0egi5V4SJ3KE=
github.com/unistack-org/micro-codec-xml/v3 v3.2.2/go.mod h1:75yGkasLbY2QsVnjzXiovlXPgsm+ddA43IKspWS5vNo=
github.com/unistack-org/micro-config-env/v3 v3.3.0 h1:7YsYImoF4zOXZEwrqOdRjyJhNaRiJU+JCjtoziJMWnE= github.com/unistack-org/micro-config-env/v3 v3.3.0 h1:7YsYImoF4zOXZEwrqOdRjyJhNaRiJU+JCjtoziJMWnE=
github.com/unistack-org/micro-config-env/v3 v3.3.0/go.mod h1:3DyAJfejBTpLMXoDv5UE6jEVKeSbeIntLR0SWdrR/oE= github.com/unistack-org/micro-config-env/v3 v3.3.0/go.mod h1:3DyAJfejBTpLMXoDv5UE6jEVKeSbeIntLR0SWdrR/oE=
github.com/unistack-org/micro-config-vault/v3 v3.2.9 h1:QXdqZSWmImAI7hC0KVRsMruTYm8++RWAdggEM+D8crY= github.com/unistack-org/micro-config-vault/v3 v3.2.9 h1:QXdqZSWmImAI7hC0KVRsMruTYm8++RWAdggEM+D8crY=
@ -498,8 +501,11 @@ github.com/unistack-org/micro/v3 v3.2.11/go.mod h1:uGPB8BhDWHj63tR3eaoCd3X+lPtAg
github.com/unistack-org/micro/v3 v3.2.24/go.mod h1:iJwCWq2PECMxigfqe6TPC5GLWvj6P94Kk+PTVZGL3w8= github.com/unistack-org/micro/v3 v3.2.24/go.mod h1:iJwCWq2PECMxigfqe6TPC5GLWvj6P94Kk+PTVZGL3w8=
github.com/unistack-org/micro/v3 v3.3.13/go.mod h1:98hNcMXp/WyWJwLwCuwrhN1Jm7aCWaRNsMfRjK8Fq+Y= github.com/unistack-org/micro/v3 v3.3.13/go.mod h1:98hNcMXp/WyWJwLwCuwrhN1Jm7aCWaRNsMfRjK8Fq+Y=
github.com/unistack-org/micro/v3 v3.3.16/go.mod h1:ETGcQQUcjxGaD44LUMX+0fgo8Loh7ExldfIPLvfUmDo= github.com/unistack-org/micro/v3 v3.3.16/go.mod h1:ETGcQQUcjxGaD44LUMX+0fgo8Loh7ExldfIPLvfUmDo=
github.com/unistack-org/micro/v3 v3.3.17 h1:WcyS7InP0DlS/JpRQGLh5sG6VstkdHJbgpMp+gmHmwg=
github.com/unistack-org/micro/v3 v3.3.17/go.mod h1:022EOEZZ789hZY3yB5ZSMXU6jLiadBgcNB/cpediV3c= github.com/unistack-org/micro/v3 v3.3.17/go.mod h1:022EOEZZ789hZY3yB5ZSMXU6jLiadBgcNB/cpediV3c=
github.com/unistack-org/micro/v3 v3.3.19/go.mod h1:LXmPfbJnJNvL0kQs8HfnkV3Wya2Wb+C7keVq++RCZnk=
github.com/unistack-org/micro/v3 v3.3.20/go.mod h1:LXmPfbJnJNvL0kQs8HfnkV3Wya2Wb+C7keVq++RCZnk=
github.com/unistack-org/micro/v3 v3.4.2 h1:BySpFG/HBxYeHcNzU8btnFpAT0sGt9aHhXCOb1Z9s9g=
github.com/unistack-org/micro/v3 v3.4.2/go.mod h1:LXmPfbJnJNvL0kQs8HfnkV3Wya2Wb+C7keVq++RCZnk=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2ObdkI= github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2ObdkI=
@ -512,6 +518,10 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:
github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=
github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
github.com/zeebo/errs v1.2.2 h1:5NFypMTuSdoySVTqlNs1dEoU21QVamMQJxW/Fii5O7g=
github.com/zeebo/errs v1.2.2/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
@ -609,6 +619,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180622082034-63fc586f45fe/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180622082034-63fc586f45fe/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -741,8 +752,8 @@ google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.37.1 h1:ARnQJNWxGyYJpdf/JXscNlQr/uv607ZPU9Z7ogHi+iI= google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0=
google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@ -796,3 +807,5 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
storj.io/drpc v0.0.23 h1:MHVOMVoBbQkPuL17GerlGTA9PLwE1HF6zAOYFvWwYG4=
storj.io/drpc v0.0.23/go.mod h1:OSJH7wvH3yKlhnMHwblKJioaaeyI6X8xbXT1SG9woe8=

10
protoc-gen-micro/generate.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh -e
INC=$(go list -f '{{ .Dir }}' -m github.com/unistack-org/micro-proto)
INC_CODEC=$(go list -f '{{ .Dir }}' -m github.com/unistack-org/micro/v3)
ARGS="-I${INC}"
CODEC_ARGS="-I${INC_CODEC}"
protoc $ARGS $CODEC_ARGS -Iproto --openapiv2_out=disable_default_errors=true,allow_merge=true:./proto/ --go_out=paths=source_relative:./proto/ proto/*.proto
protoc $ARGS $CODEC_ARGS -Iproto --go-micro_out=components="micro|http",debug=true,tag_path=./proto/,paths=source_relative:./proto/ proto/*.proto

View File

@ -0,0 +1,180 @@
{
"swagger": "2.0",
"info": {
"title": "test.proto",
"version": "version not set"
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/aml": {
"post": {
"operationId": "TestService_KzAmlRs",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/testResponseAml"
}
}
},
"tags": [
"TestService"
]
}
},
"/users/image/upload": {
"post": {
"operationId": "TestService_UploadFile",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/testResponseImage"
}
}
},
"tags": [
"TestService"
]
}
},
"/users/test": {
"get": {
"operationId": "TestService_TestEndpoint",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/testResponse"
}
}
},
"parameters": [
{
"name": "id",
"in": "query",
"required": false,
"type": "string"
}
],
"tags": [
"TestService"
]
}
},
"/users/{id}": {
"get": {
"operationId": "TestService_UserByID",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/testResponse"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"TestService"
]
}
},
"/users/{id}/image": {
"get": {
"operationId": "TestService_UserImageByID",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/codecFrame"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"TestService"
]
}
}
},
"definitions": {
"codecFrame": {
"type": "object",
"properties": {
"data": {
"type": "string",
"format": "byte"
}
}
},
"testKZAmlNewOnlineRs": {
"type": "object",
"properties": {
"rquid": {
"type": "string"
},
"rqtm": {
"type": "string"
},
"status": {
"$ref": "#/definitions/testStatus"
},
"terrStatus": {
"type": "string",
"format": "int64"
},
"amlStatus": {
"type": "string",
"format": "int64"
}
}
},
"testResponse": {
"type": "object",
"properties": {
"encodedId": {
"type": "string"
}
}
},
"testResponseAml": {
"type": "object",
"properties": {
"resp": {
"type": "string"
}
}
},
"testResponseImage": {
"type": "object"
},
"testStatus": {
"type": "object",
"properties": {
"statusCode": {
"type": "string",
"format": "int64"
}
}
}
}
}

View File

@ -0,0 +1,684 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.15.6
// source: test.proto
package pb
import (
_ "github.com/unistack-org/micro-proto/api"
_ "github.com/unistack-org/micro-proto/tag"
codec "github.com/unistack-org/micro/v3/codec"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type RequestAml struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
KzAmlNewOnlineRs *KZAmlNewOnlineRs `protobuf:"bytes,1,opt,name=kzAmlNewOnlineRs,proto3" json:"kzAmlNewOnlineRs,omitempty" xml:"KZAmlNewOnlineRs"`
}
func (x *RequestAml) Reset() {
*x = RequestAml{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RequestAml) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RequestAml) ProtoMessage() {}
func (x *RequestAml) ProtoReflect() protoreflect.Message {
mi := &file_test_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RequestAml.ProtoReflect.Descriptor instead.
func (*RequestAml) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{0}
}
func (x *RequestAml) GetKzAmlNewOnlineRs() *KZAmlNewOnlineRs {
if x != nil {
return x.KzAmlNewOnlineRs
}
return nil
}
type KZAmlNewOnlineRs struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Rquid string `protobuf:"bytes,1,opt,name=rquid,proto3" json:"rquid,omitempty" xml:"RqUID"`
Rqtm string `protobuf:"bytes,2,opt,name=rqtm,proto3" json:"rqtm,omitempty" xml:"RqTm"`
Status *Status `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty" xml:"Status"`
TerrStatus int64 `protobuf:"varint,4,opt,name=terr_status,json=terrStatus,proto3" json:"terr_status,omitempty" xml:"TerrStatus"`
AmlStatus int64 `protobuf:"varint,5,opt,name=aml_status,json=amlStatus,proto3" json:"aml_status,omitempty" xml:"AMLStatus"`
}
func (x *KZAmlNewOnlineRs) Reset() {
*x = KZAmlNewOnlineRs{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *KZAmlNewOnlineRs) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*KZAmlNewOnlineRs) ProtoMessage() {}
func (x *KZAmlNewOnlineRs) ProtoReflect() protoreflect.Message {
mi := &file_test_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use KZAmlNewOnlineRs.ProtoReflect.Descriptor instead.
func (*KZAmlNewOnlineRs) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{1}
}
func (x *KZAmlNewOnlineRs) GetRquid() string {
if x != nil {
return x.Rquid
}
return ""
}
func (x *KZAmlNewOnlineRs) GetRqtm() string {
if x != nil {
return x.Rqtm
}
return ""
}
func (x *KZAmlNewOnlineRs) GetStatus() *Status {
if x != nil {
return x.Status
}
return nil
}
func (x *KZAmlNewOnlineRs) GetTerrStatus() int64 {
if x != nil {
return x.TerrStatus
}
return 0
}
func (x *KZAmlNewOnlineRs) GetAmlStatus() int64 {
if x != nil {
return x.AmlStatus
}
return 0
}
type Status struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
StatusCode int64 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty" xml:"StatusCode"`
}
func (x *Status) Reset() {
*x = Status{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Status) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Status) ProtoMessage() {}
func (x *Status) ProtoReflect() protoreflect.Message {
mi := &file_test_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Status.ProtoReflect.Descriptor instead.
func (*Status) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{2}
}
func (x *Status) GetStatusCode() int64 {
if x != nil {
return x.StatusCode
}
return 0
}
type ResponseAml struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Resp string `protobuf:"bytes,1,opt,name=resp,proto3" json:"resp,omitempty"`
}
func (x *ResponseAml) Reset() {
*x = ResponseAml{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResponseAml) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResponseAml) ProtoMessage() {}
func (x *ResponseAml) ProtoReflect() protoreflect.Message {
mi := &file_test_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ResponseAml.ProtoReflect.Descriptor instead.
func (*ResponseAml) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{3}
}
func (x *ResponseAml) GetResp() string {
if x != nil {
return x.Resp
}
return ""
}
type RequestImage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Image []byte `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
FileName string `protobuf:"bytes,2,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"`
DocType string `protobuf:"bytes,3,opt,name=doc_type,json=docType,proto3" json:"doc_type,omitempty"`
}
func (x *RequestImage) Reset() {
*x = RequestImage{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RequestImage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RequestImage) ProtoMessage() {}
func (x *RequestImage) ProtoReflect() protoreflect.Message {
mi := &file_test_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RequestImage.ProtoReflect.Descriptor instead.
func (*RequestImage) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{4}
}
func (x *RequestImage) GetImage() []byte {
if x != nil {
return x.Image
}
return nil
}
func (x *RequestImage) GetFileName() string {
if x != nil {
return x.FileName
}
return ""
}
func (x *RequestImage) GetDocType() string {
if x != nil {
return x.DocType
}
return ""
}
type ResponseImage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ResponseImage) Reset() {
*x = ResponseImage{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResponseImage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResponseImage) ProtoMessage() {}
func (x *ResponseImage) ProtoReflect() protoreflect.Message {
mi := &file_test_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ResponseImage.ProtoReflect.Descriptor instead.
func (*ResponseImage) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{5}
}
type Request struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (x *Request) Reset() {
*x = Request{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Request) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Request) ProtoMessage() {}
func (x *Request) ProtoReflect() protoreflect.Message {
mi := &file_test_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Request.ProtoReflect.Descriptor instead.
func (*Request) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{6}
}
func (x *Request) GetId() string {
if x != nil {
return x.Id
}
return ""
}
type Response struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
EncodedId string `protobuf:"bytes,1,opt,name=encoded_id,json=encodedId,proto3" json:"encoded_id,omitempty" xml:"encoded_id,attr"`
}
func (x *Response) Reset() {
*x = Response{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Response) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Response) ProtoMessage() {}
func (x *Response) ProtoReflect() protoreflect.Message {
mi := &file_test_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Response.ProtoReflect.Descriptor instead.
func (*Response) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{7}
}
func (x *Response) GetEncodedId() string {
if x != nil {
return x.EncodedId
}
return ""
}
var File_test_proto protoreflect.FileDescriptor
var file_test_proto_rawDesc = []byte{
0x0a, 0x0a, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x74, 0x65,
0x73, 0x74, 0x1a, 0x15, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x63, 0x6f, 0x64, 0x65, 0x63,
0x2f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, 0x74, 0x61,
0x67, 0x2f, 0x74, 0x61, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6d, 0x0a, 0x0a, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x41, 0x6d, 0x6c, 0x12, 0x5f, 0x0a, 0x10, 0x6b, 0x7a, 0x41,
0x6d, 0x6c, 0x4e, 0x65, 0x77, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x73, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4b, 0x5a, 0x41, 0x6d, 0x6c,
0x4e, 0x65, 0x77, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x73, 0x42, 0x1b, 0x9a, 0x84, 0x9e,
0x03, 0x16, 0x78, 0x6d, 0x6c, 0x3a, 0x22, 0x4b, 0x5a, 0x41, 0x6d, 0x6c, 0x4e, 0x65, 0x77, 0x4f,
0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x73, 0x22, 0x52, 0x10, 0x6b, 0x7a, 0x41, 0x6d, 0x6c, 0x4e,
0x65, 0x77, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x73, 0x22, 0x85, 0x02, 0x0a, 0x10, 0x4b,
0x5a, 0x41, 0x6d, 0x6c, 0x4e, 0x65, 0x77, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x73, 0x12,
0x26, 0x0a, 0x05, 0x72, 0x71, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x10,
0x9a, 0x84, 0x9e, 0x03, 0x0b, 0x78, 0x6d, 0x6c, 0x3a, 0x22, 0x52, 0x71, 0x55, 0x49, 0x44, 0x22,
0x52, 0x05, 0x72, 0x71, 0x75, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x04, 0x72, 0x71, 0x74, 0x6d, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0x9a, 0x84, 0x9e, 0x03, 0x0a, 0x78, 0x6d, 0x6c, 0x3a,
0x22, 0x52, 0x71, 0x54, 0x6d, 0x22, 0x52, 0x04, 0x72, 0x71, 0x74, 0x6d, 0x12, 0x37, 0x0a, 0x06,
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x74,
0x65, 0x73, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x11, 0x9a, 0x84, 0x9e, 0x03,
0x0c, 0x78, 0x6d, 0x6c, 0x3a, 0x22, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x52, 0x06, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x36, 0x0a, 0x0b, 0x74, 0x65, 0x72, 0x72, 0x5f, 0x73, 0x74,
0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x42, 0x15, 0x9a, 0x84, 0x9e, 0x03,
0x10, 0x78, 0x6d, 0x6c, 0x3a, 0x22, 0x54, 0x65, 0x72, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x22, 0x52, 0x0a, 0x74, 0x65, 0x72, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x33, 0x0a,
0x0a, 0x61, 0x6d, 0x6c, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28,
0x03, 0x42, 0x14, 0x9a, 0x84, 0x9e, 0x03, 0x0f, 0x78, 0x6d, 0x6c, 0x3a, 0x22, 0x41, 0x4d, 0x4c,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x52, 0x09, 0x61, 0x6d, 0x6c, 0x53, 0x74, 0x61, 0x74,
0x75, 0x73, 0x22, 0x40, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x36, 0x0a, 0x0b,
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x03, 0x42, 0x15, 0x9a, 0x84, 0x9e, 0x03, 0x10, 0x78, 0x6d, 0x6c, 0x3a, 0x22, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
0x43, 0x6f, 0x64, 0x65, 0x22, 0x21, 0x0a, 0x0b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x41, 0x6d, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x65, 0x73, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x72, 0x65, 0x73, 0x70, 0x22, 0x5c, 0x0a, 0x0c, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a,
0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x6f,
0x63, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x6f,
0x63, 0x54, 0x79, 0x70, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x22, 0x19, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
0x64, 0x22, 0x45, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a,
0x0a, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x42, 0x1a, 0x9a, 0x84, 0x9e, 0x03, 0x15, 0x78, 0x6d, 0x6c, 0x3a, 0x22, 0x65, 0x6e, 0x63,
0x6f, 0x64, 0x65, 0x64, 0x5f, 0x69, 0x64, 0x2c, 0x61, 0x74, 0x74, 0x72, 0x22, 0x52, 0x09, 0x65,
0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x49, 0x64, 0x32, 0xf2, 0x02, 0x0a, 0x0b, 0x54, 0x65, 0x73,
0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x42, 0x0a, 0x0c, 0x54, 0x65, 0x73, 0x74,
0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x0d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x12,
0x0b, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x08,
0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x49, 0x44, 0x12, 0x0d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x12,
0x0b, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x4d, 0x0a, 0x0d,
0x55, 0x73, 0x65, 0x72, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x42, 0x79, 0x49, 0x44, 0x12, 0x0d, 0x2e,
0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d,
0x69, 0x63, 0x72, 0x6f, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65,
0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73,
0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x52, 0x0a, 0x0a, 0x55,
0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x2e, 0x74, 0x65, 0x73, 0x74,
0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x1a, 0x13, 0x2e,
0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x6d, 0x61,
0x67, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, 0x13, 0x2f, 0x75, 0x73, 0x65,
0x72, 0x73, 0x2f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x12,
0x3c, 0x0a, 0x07, 0x4b, 0x7a, 0x41, 0x6d, 0x6c, 0x52, 0x73, 0x12, 0x10, 0x2e, 0x74, 0x65, 0x73,
0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x41, 0x6d, 0x6c, 0x1a, 0x11, 0x2e, 0x74,
0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x41, 0x6d, 0x6c, 0x22,
0x0c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x06, 0x22, 0x04, 0x2f, 0x61, 0x6d, 0x6c, 0x42, 0x0b, 0x5a,
0x09, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
}
var (
file_test_proto_rawDescOnce sync.Once
file_test_proto_rawDescData = file_test_proto_rawDesc
)
func file_test_proto_rawDescGZIP() []byte {
file_test_proto_rawDescOnce.Do(func() {
file_test_proto_rawDescData = protoimpl.X.CompressGZIP(file_test_proto_rawDescData)
})
return file_test_proto_rawDescData
}
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_test_proto_goTypes = []interface{}{
(*RequestAml)(nil), // 0: test.RequestAml
(*KZAmlNewOnlineRs)(nil), // 1: test.KZAmlNewOnlineRs
(*Status)(nil), // 2: test.Status
(*ResponseAml)(nil), // 3: test.ResponseAml
(*RequestImage)(nil), // 4: test.RequestImage
(*ResponseImage)(nil), // 5: test.ResponseImage
(*Request)(nil), // 6: test.Request
(*Response)(nil), // 7: test.Response
(*codec.Frame)(nil), // 8: micro.codec.Frame
}
var file_test_proto_depIdxs = []int32{
1, // 0: test.RequestAml.kzAmlNewOnlineRs:type_name -> test.KZAmlNewOnlineRs
2, // 1: test.KZAmlNewOnlineRs.status:type_name -> test.Status
6, // 2: test.TestService.TestEndpoint:input_type -> test.Request
6, // 3: test.TestService.UserByID:input_type -> test.Request
6, // 4: test.TestService.UserImageByID:input_type -> test.Request
4, // 5: test.TestService.UploadFile:input_type -> test.RequestImage
0, // 6: test.TestService.KzAmlRs:input_type -> test.RequestAml
7, // 7: test.TestService.TestEndpoint:output_type -> test.Response
7, // 8: test.TestService.UserByID:output_type -> test.Response
8, // 9: test.TestService.UserImageByID:output_type -> micro.codec.Frame
5, // 10: test.TestService.UploadFile:output_type -> test.ResponseImage
3, // 11: test.TestService.KzAmlRs:output_type -> test.ResponseAml
7, // [7:12] is the sub-list for method output_type
2, // [2:7] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_test_proto_init() }
func file_test_proto_init() {
if File_test_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_test_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RequestAml); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*KZAmlNewOnlineRs); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Status); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResponseAml); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RequestImage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResponseImage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Request); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Response); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_test_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_test_proto_goTypes,
DependencyIndexes: file_test_proto_depIdxs,
MessageInfos: file_test_proto_msgTypes,
}.Build()
File_test_proto = out.File
file_test_proto_rawDesc = nil
file_test_proto_goTypes = nil
file_test_proto_depIdxs = nil
}

View File

@ -0,0 +1,73 @@
syntax="proto3";
package test;
option go_package="/proto;pb";
import "api/annotations.proto";
import "codec/frame.proto";
import "tag/tag.proto";
service TestService {
rpc TestEndpoint(Request) returns (Response) {
option (micro.api.http) = {
get: "/users/test"
};
}
rpc UserByID(Request) returns (Response) {
option (micro.api.http) = {
get: "/users/{id}"
};
};
rpc UserImageByID(Request) returns (micro.codec.Frame) {
option (micro.api.http) = {
get: "/users/{id}/image"
};
};
rpc UploadFile(RequestImage) returns (ResponseImage) {
option (micro.api.http) = {
post: "/users/image/upload"
};
}
rpc KzAmlRs(RequestAml) returns (ResponseAml) {
option (micro.api.http) = {
post: "/aml"
};
}
};
message RequestAml {
KZAmlNewOnlineRs kzAmlNewOnlineRs = 1 [(micro.tag.tags) = "xml:\"KZAmlNewOnlineRs\"" ];
}
message KZAmlNewOnlineRs {
string rquid = 1 [(micro.tag.tags) = "xml:\"RqUID\"" ];
string rqtm = 2 [(micro.tag.tags) = "xml:\"RqTm\"" ];
Status status = 3 [(micro.tag.tags) = "xml:\"Status\"" ];
int64 terr_status = 4 [(micro.tag.tags) = "xml:\"TerrStatus\"" ];
int64 aml_status = 5 [(micro.tag.tags) = "xml:\"AMLStatus\"" ];
}
message Status {
int64 status_code = 1 [(micro.tag.tags) = "xml:\"StatusCode\"" ];
}
message ResponseAml {
string resp = 1;
}
message RequestImage {
bytes image = 1;
string file_name = 2;
string doc_type = 3;
}
message ResponseImage {}
message Request {
string id = 1;
}
message Response {
string encoded_id = 1 [(micro.tag.tags) = "xml:\"encoded_id,attr\"" ];
}

View File

@ -0,0 +1,61 @@
// Code generated by protoc-gen-micro
// source: test.proto
package pb
import (
context "context"
api "github.com/unistack-org/micro/v3/api"
client "github.com/unistack-org/micro/v3/client"
codec "github.com/unistack-org/micro/v3/codec"
)
func NewTestServiceEndpoints() []*api.Endpoint {
return []*api.Endpoint{
&api.Endpoint{
Name: "TestService.TestEndpoint",
Path: []string{"/users/test"},
Method: []string{"GET"},
Handler: "rpc",
},
&api.Endpoint{
Name: "TestService.UserByID",
Path: []string{"/users/{id}"},
Method: []string{"GET"},
Handler: "rpc",
},
&api.Endpoint{
Name: "TestService.UserImageByID",
Path: []string{"/users/{id}/image"},
Method: []string{"GET"},
Handler: "rpc",
},
&api.Endpoint{
Name: "TestService.UploadFile",
Path: []string{"/users/image/upload"},
Method: []string{"POST"},
Handler: "rpc",
},
&api.Endpoint{
Name: "TestService.KzAmlRs",
Path: []string{"/aml"},
Method: []string{"POST"},
Handler: "rpc",
},
}
}
type TestServiceClient interface {
TestEndpoint(ctx context.Context, req *Request, opts ...client.CallOption) (*Response, error)
UserByID(ctx context.Context, req *Request, opts ...client.CallOption) (*Response, error)
UserImageByID(ctx context.Context, req *Request, opts ...client.CallOption) (*codec.Frame, error)
UploadFile(ctx context.Context, req *RequestImage, opts ...client.CallOption) (*ResponseImage, error)
KzAmlRs(ctx context.Context, req *RequestAml, opts ...client.CallOption) (*ResponseAml, error)
}
type TestServiceServer interface {
TestEndpoint(ctx context.Context, req *Request, rsp *Response) error
UserByID(ctx context.Context, req *Request, rsp *Response) error
UserImageByID(ctx context.Context, req *Request, rsp *codec.Frame) error
UploadFile(ctx context.Context, req *RequestImage, rsp *ResponseImage) error
KzAmlRs(ctx context.Context, req *RequestAml, rsp *ResponseAml) error
}

View File

@ -0,0 +1,130 @@
// Code generated by protoc-gen-micro
// source: test.proto
package pb
import (
context "context"
v3 "github.com/unistack-org/micro-client-http/v3"
api "github.com/unistack-org/micro/v3/api"
client "github.com/unistack-org/micro/v3/client"
codec "github.com/unistack-org/micro/v3/codec"
server "github.com/unistack-org/micro/v3/server"
http "net/http"
)
type testServiceClient struct {
c client.Client
name string
}
func NewTestServiceClient(name string, c client.Client) TestServiceClient {
return &testServiceClient{c: c, name: name}
}
func (c *testServiceClient) TestEndpoint(ctx context.Context, req *Request, opts ...client.CallOption) (*Response, error) {
opts = append(opts,
v3.Method(http.MethodGet),
v3.Path("/users/test"),
)
rsp := &Response{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.TestEndpoint", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *testServiceClient) UserByID(ctx context.Context, req *Request, opts ...client.CallOption) (*Response, error) {
opts = append(opts,
v3.Method(http.MethodGet),
v3.Path("/users/{id}"),
)
rsp := &Response{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.UserByID", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *testServiceClient) UserImageByID(ctx context.Context, req *Request, opts ...client.CallOption) (*codec.Frame, error) {
opts = append(opts,
v3.Method(http.MethodGet),
v3.Path("/users/{id}/image"),
)
rsp := &codec.Frame{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.UserImageByID", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *testServiceClient) UploadFile(ctx context.Context, req *RequestImage, opts ...client.CallOption) (*ResponseImage, error) {
opts = append(opts,
v3.Method(http.MethodPost),
v3.Path("/users/image/upload"),
)
rsp := &ResponseImage{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.UploadFile", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *testServiceClient) KzAmlRs(ctx context.Context, req *RequestAml, opts ...client.CallOption) (*ResponseAml, error) {
opts = append(opts,
v3.Method(http.MethodPost),
v3.Path("/aml"),
)
rsp := &ResponseAml{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.KzAmlRs", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
type testServiceServer struct {
TestServiceServer
}
func (h *testServiceServer) TestEndpoint(ctx context.Context, req *Request, rsp *Response) error {
return h.TestServiceServer.TestEndpoint(ctx, req, rsp)
}
func (h *testServiceServer) UserByID(ctx context.Context, req *Request, rsp *Response) error {
return h.TestServiceServer.UserByID(ctx, req, rsp)
}
func (h *testServiceServer) UserImageByID(ctx context.Context, req *Request, rsp *codec.Frame) error {
return h.TestServiceServer.UserImageByID(ctx, req, rsp)
}
func (h *testServiceServer) UploadFile(ctx context.Context, req *RequestImage, rsp *ResponseImage) error {
return h.TestServiceServer.UploadFile(ctx, req, rsp)
}
func (h *testServiceServer) KzAmlRs(ctx context.Context, req *RequestAml, rsp *ResponseAml) error {
return h.TestServiceServer.KzAmlRs(ctx, req, rsp)
}
func RegisterTestServiceServer(s server.Server, sh TestServiceServer, opts ...server.HandlerOption) error {
type testService interface {
TestEndpoint(ctx context.Context, req *Request, rsp *Response) error
UserByID(ctx context.Context, req *Request, rsp *Response) error
UserImageByID(ctx context.Context, req *Request, rsp *codec.Frame) error
UploadFile(ctx context.Context, req *RequestImage, rsp *ResponseImage) error
KzAmlRs(ctx context.Context, req *RequestAml, rsp *ResponseAml) error
}
type TestService struct {
testService
}
h := &testServiceServer{sh}
var nopts []server.HandlerOption
for _, endpoint := range NewTestServiceEndpoints() {
nopts = append(nopts, api.WithEndpoint(endpoint))
}
return s.Handle(s.NewHandler(&TestService{h}, append(nopts, opts...)...))
}

View File

@ -1,3 +1,3 @@
package grpc package grpc
//go:generate protoc -I./proto -I$GOPATH/pkg/mod/github.com/grpc-ecosystem/grpc-gateway@v1.9.5/third_party/googleapis -I. --go-grpc_out=paths=source_relative:./proto --go_out=paths=source_relative:./proto --micro_out=components=micro|rpc,debug=true,standalone=true,paths=source_relative:./gproto proto/test.proto //go:generate protoc -I./proto -I$GOPATH/pkg/mod/github.com/grpc-ecosystem/grpc-gateway@v1.9.5/third_party/googleapis -I. --go-grpc_out=paths=source_relative:./proto --go_out=paths=source_relative:./proto --go-micro_out=components=micro|rpc,debug=true,standalone=true,paths=source_relative:./gproto proto/test.proto

View File

@ -1,5 +1,7 @@
// Code generated by protoc-gen-micro // Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.4.0
// source: test.proto // source: test.proto
package helloworld package helloworld
import ( import (
@ -9,9 +11,9 @@ import (
client "github.com/unistack-org/micro/v3/client" client "github.com/unistack-org/micro/v3/client"
) )
func NewTestEndpoints() []*api.Endpoint { var (
return []*api.Endpoint{ TestEndpoints = []api.Endpoint{
&api.Endpoint{ api.Endpoint{
Name: "Test.Call", Name: "Test.Call",
Path: []string{"/api/v0/test/call/TEST"}, Path: []string{"/api/v0/test/call/TEST"},
Method: []string{"POST"}, Method: []string{"POST"},
@ -19,6 +21,10 @@ func NewTestEndpoints() []*api.Endpoint {
Handler: "rpc", Handler: "rpc",
}, },
} }
)
func NewTestEndpoints() []api.Endpoint {
return TestEndpoints
} }
type TestClient interface { type TestClient interface {

View File

@ -1,5 +1,7 @@
// Code generated by protoc-gen-micro // Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.4.0
// source: test.proto // source: test.proto
package helloworld package helloworld
import ( import (
@ -45,8 +47,8 @@ func RegisterTestServer(s server.Server, sh TestServer, opts ...server.HandlerOp
} }
h := &testServer{sh} h := &testServer{sh}
var nopts []server.HandlerOption var nopts []server.HandlerOption
for _, endpoint := range NewTestEndpoints() { for _, endpoint := range TestEndpoints {
nopts = append(nopts, api.WithEndpoint(endpoint)) nopts = append(nopts, api.WithEndpoint(&endpoint))
} }
return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...)) return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...))
} }

View File

@ -2,4 +2,4 @@ package http
//go:generate protoc -I./proto -I. -I/home/vtolstov/devel/projects/unistack/micro/micro-proto --go_out=paths=source_relative:./proto proto/test.proto //go:generate protoc -I./proto -I. -I/home/vtolstov/devel/projects/unistack/micro/micro-proto --go_out=paths=source_relative:./proto proto/test.proto
//go:generate protoc -I./proto -I. -I/home/vtolstov/devel/projects/unistack/micro/micro-proto --micro_out=components=micro|http,debug=true,tag_path=./proto,paths=source_relative:./proto proto/test.proto //go:generate protoc -I./proto -I. -I/home/vtolstov/devel/projects/unistack/micro/micro-proto --go-micro_out=components=micro|http,debug=true,tag_path=./proto,paths=source_relative:./proto proto/test.proto

View File

@ -16,6 +16,7 @@ import (
jsoncodec "github.com/unistack-org/micro-codec-json/v3" jsoncodec "github.com/unistack-org/micro-codec-json/v3"
jsonpbcodec "github.com/unistack-org/micro-codec-jsonpb/v3" jsonpbcodec "github.com/unistack-org/micro-codec-jsonpb/v3"
urlencodecodec "github.com/unistack-org/micro-codec-urlencode/v3" urlencodecodec "github.com/unistack-org/micro-codec-urlencode/v3"
xmlcodec "github.com/unistack-org/micro-codec-xml/v3"
vmeter "github.com/unistack-org/micro-meter-victoriametrics/v3" vmeter "github.com/unistack-org/micro-meter-victoriametrics/v3"
httpsrv "github.com/unistack-org/micro-server-http/v3" httpsrv "github.com/unistack-org/micro-server-http/v3"
pb "github.com/unistack-org/micro-tests/server/http/proto" pb "github.com/unistack-org/micro-tests/server/http/proto"
@ -143,10 +144,19 @@ func NewServerHandlerWrapper(t *testing.T) server.HandlerWrapper {
} }
nmd := metadata.New(1) nmd := metadata.New(1)
nmd.Set("my-key", "my-val") nmd.Set("my-key", "my-val")
nmd.Set("Content-Type", "text/xml")
metadata.SetOutgoingContext(ctx, nmd) metadata.SetOutgoingContext(ctx, nmd)
httpsrv.SetRspCode(ctx, http.StatusUnauthorized) httpsrv.SetRspCode(ctx, http.StatusUnauthorized)
return httpsrv.SetError(&pb.CallRsp{Rsp: "name_my_name"}) return httpsrv.SetError(&pb.CallRsp{Rsp: "name_my_name"})
} }
if v, ok := md.Get("Test-Content-Type"); ok && v != "" {
nmd := metadata.New(1)
nmd.Set("my-key", "my-val")
nmd.Set("Content-Type", v)
metadata.SetOutgoingContext(ctx, nmd)
}
return fn(ctx, req, rsp) return fn(ctx, req, rsp)
} }
} }
@ -470,6 +480,7 @@ func TestNativeServer(t *testing.T) {
srv := httpsrv.NewServer( srv := httpsrv.NewServer(
server.Name("helloworld"), server.Name("helloworld"),
server.Register(reg), server.Register(reg),
server.Codec("text/xml", xmlcodec.NewCodec()),
server.Codec("application/json", jsoncodec.NewCodec()), server.Codec("application/json", jsoncodec.NewCodec()),
server.Codec("application/x-www-form-urlencoded", urlencodecodec.NewCodec()), server.Codec("application/x-www-form-urlencoded", urlencodecodec.NewCodec()),
server.WrapHandler(NewServerHandlerWrapper(t)), server.WrapHandler(NewServerHandlerWrapper(t)),
@ -594,6 +605,8 @@ func TestNativeServer(t *testing.T) {
t.Fatalf("invalid rsp received: %#+v\n", rsp) t.Fatalf("invalid rsp received: %#+v\n", rsp)
} }
// Test-Content-Type
// stop server // stop server
if err := srv.Stop(); err != nil { if err := srv.Stop(); err != nil {
t.Fatal(err) t.Fatal(err)

View File

@ -1,5 +1,7 @@
// Code generated by protoc-gen-micro // Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.4.0
// source: test.proto // source: test.proto
package pb package pb
import ( import (
@ -8,9 +10,9 @@ import (
client "github.com/unistack-org/micro/v3/client" client "github.com/unistack-org/micro/v3/client"
) )
func NewTestDoubleEndpoints() []*api.Endpoint { var (
return []*api.Endpoint{ TestDoubleEndpoints = []api.Endpoint{
&api.Endpoint{ api.Endpoint{
Name: "TestDouble.CallDouble", Name: "TestDouble.CallDouble",
Path: []string{"/v1/testdouble/call/{name}"}, Path: []string{"/v1/testdouble/call/{name}"},
Method: []string{"POST"}, Method: []string{"POST"},
@ -18,6 +20,10 @@ func NewTestDoubleEndpoints() []*api.Endpoint {
Handler: "rpc", Handler: "rpc",
}, },
} }
)
func NewTestDoubleEndpoints() []api.Endpoint {
return TestDoubleEndpoints
} }
type TestDoubleClient interface { type TestDoubleClient interface {
@ -28,30 +34,30 @@ type TestDoubleServer interface {
CallDouble(ctx context.Context, req *CallReq, rsp *CallRsp) error CallDouble(ctx context.Context, req *CallReq, rsp *CallRsp) error
} }
func NewTestEndpoints() []*api.Endpoint { var (
return []*api.Endpoint{ TestEndpoints = []api.Endpoint{
&api.Endpoint{ api.Endpoint{
Name: "Test.CallRepeatedString", Name: "Test.CallRepeatedString",
Path: []string{"/v1/test/call_repeated_string/{string_ids}"}, Path: []string{"/v1/test/call_repeated_string/{string_ids}"},
Method: []string{"POST"}, Method: []string{"POST"},
Body: "*", Body: "*",
Handler: "rpc", Handler: "rpc",
}, },
&api.Endpoint{ api.Endpoint{
Name: "Test.CallRepeatedInt64", Name: "Test.CallRepeatedInt64",
Path: []string{"/v1/test/call_repeated_int64/{int64_ids}"}, Path: []string{"/v1/test/call_repeated_int64/{int64_ids}"},
Method: []string{"POST"}, Method: []string{"POST"},
Body: "*", Body: "*",
Handler: "rpc", Handler: "rpc",
}, },
&api.Endpoint{ api.Endpoint{
Name: "Test.Call", Name: "Test.Call",
Path: []string{"/v1/test/call/{name}"}, Path: []string{"/v1/test/call/{name}"},
Method: []string{"POST"}, Method: []string{"POST"},
Body: "*", Body: "*",
Handler: "rpc", Handler: "rpc",
}, },
&api.Endpoint{ api.Endpoint{
Name: "Test.CallError", Name: "Test.CallError",
Path: []string{"/v1/test/callerror/{name}"}, Path: []string{"/v1/test/callerror/{name}"},
Method: []string{"POST"}, Method: []string{"POST"},
@ -59,6 +65,10 @@ func NewTestEndpoints() []*api.Endpoint {
Handler: "rpc", Handler: "rpc",
}, },
} }
)
func NewTestEndpoints() []api.Endpoint {
return TestEndpoints
} }
type TestClient interface { type TestClient interface {

View File

@ -1,5 +1,7 @@
// Code generated by protoc-gen-micro // Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.4.0
// source: test.proto // source: test.proto
package pb package pb
import ( import (
@ -61,8 +63,8 @@ func RegisterTestDoubleServer(s server.Server, sh TestDoubleServer, opts ...serv
} }
h := &testDoubleServer{sh} h := &testDoubleServer{sh}
var nopts []server.HandlerOption var nopts []server.HandlerOption
for _, endpoint := range NewTestDoubleEndpoints() { for _, endpoint := range TestDoubleEndpoints {
nopts = append(nopts, api.WithEndpoint(endpoint)) nopts = append(nopts, api.WithEndpoint(&endpoint))
} }
return s.Handle(s.NewHandler(&TestDouble{h}, append(nopts, opts...)...)) return s.Handle(s.NewHandler(&TestDouble{h}, append(nopts, opts...)...))
} }
@ -196,8 +198,8 @@ func RegisterTestServer(s server.Server, sh TestServer, opts ...server.HandlerOp
} }
h := &testServer{sh} h := &testServer{sh}
var nopts []server.HandlerOption var nopts []server.HandlerOption
for _, endpoint := range NewTestEndpoints() { for _, endpoint := range TestEndpoints {
nopts = append(nopts, api.WithEndpoint(endpoint)) nopts = append(nopts, api.WithEndpoint(&endpoint))
} }
return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...)) return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...))
} }