add sql wrapper tests, regen

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2023-01-07 19:16:48 +03:00
parent de763a4f92
commit 7c71e65d02
50 changed files with 1635 additions and 273 deletions

View File

@@ -19,8 +19,8 @@ import (
mdpb "go.unistack.org/micro-tests/server/combo/mdpb"
mgpb "go.unistack.org/micro-tests/server/combo/mgpb"
mhpb "go.unistack.org/micro-tests/server/combo/mhpb"
ndpb "go.unistack.org/micro-tests/server/combo/ndpb"
ngpb "go.unistack.org/micro-tests/server/combo/ngpb"
// ndpb "go.unistack.org/micro-tests/server/combo/ndpb"
// ngpb "go.unistack.org/micro-tests/server/combo/ngpb"
pb "go.unistack.org/micro-tests/server/combo/proto"
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/codec"
@@ -192,9 +192,6 @@ func (h *Handler) HandleRPC(stream drpc.Stream, rpc string) error {
}
func TestComboServer(t *testing.T) {
req := &pb.CallReq{Req: "my_name"}
var rsp *pb.CallRsp
reg := register.NewRegister()
ctx := context.Background()
@@ -254,7 +251,7 @@ func TestComboServer(t *testing.T) {
mdrpcsvc := mdpb.NewTestClient("helloworld", mdcli)
t.Logf("call via micro grpc")
rsp, err = mgrpcsvc.Call(ctx, req)
rsp, err := mgrpcsvc.Call(ctx, &pb.CallReq{Req: "my_name"})
if err != nil {
t.Fatal(err)
} else {
@@ -263,26 +260,37 @@ func TestComboServer(t *testing.T) {
}
}
lis, err := net.Listen("tcp", fmt.Sprintf(":0"))
if err != nil {
t.Fatalf("failed to listen: %v", err)
}
s := grpc.NewServer()
pb.RegisterGreeterServer(s, &server{})
log.Printf("server listening at %v", lis.Addr())
if err := s.Serve(lis); err != nil {
log.Fatalf("failed to serve: %v", err)
}
ngcli, err := grpc.DialContext(ctx, service[0].Nodes[0].Address, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
t.Fatal(err)
}
defer ngcli.Close()
ngrpcsvc := ngpb.NewTestClient(ngcli)
t.Logf("call via native grpc")
rsp, err = ngrpcsvc.Call(ctx, req)
if err != nil {
t.Fatal(err)
} else {
if rsp.Rsp != "name_my_name" {
t.Fatalf("invalid response: %#+v\n", rsp)
/*
ngrpcsvc := ngpb.NewTestClient(ngcli)
t.Logf("call via native grpc")
if rsp, err := ngrpcsvc.Call(ctx, &ngpb.CallReq{Req: "my_name"}); err != nil {
t.Fatal(err)
} else {
if rsp.Rsp != "name_my_name" {
t.Fatalf("invalid response: %#+v\n", rsp)
}
}
}
*/
t.Logf("call via micro http")
rsp, err = mhttpsvc.Call(ctx, req)
if err != nil {
if rsp, err := mhttpsvc.Call(ctx, &pb.CallReq{Req: "my_name"}); err != nil {
t.Fatal(err)
} else {
if rsp.Rsp != "name_my_name" {
@@ -297,23 +305,21 @@ func TestComboServer(t *testing.T) {
ndcli := drpcconn.New(tc)
defer ndcli.Close()
/*
ndrpcsvc := ndpb.NewDRPCTestClient(ndcli)
ndrpcsvc := ndpb.NewDRPCTestClient(ndcli)
t.Logf("call via native drpc")
rsp, err = ndrpcsvc.Call(context.TODO(), req)
if err != nil {
t.Logf("native drpc err: %v", err)
// t.Fatal(err)
} else {
if rsp.Rsp != "name_my_name" {
t.Fatalf("invalid response: %#+v\n", rsp)
t.Logf("call via native drpc")
if rsp, err := ndrpcsvc.Call(context.TODO(), &ndpb.CallReq{Req: "my_name"}); err != nil {
t.Logf("native drpc err: %v", err)
// t.Fatal(err)
} else {
if rsp.Rsp != "name_my_name" {
t.Fatalf("invalid response: %#+v\n", rsp)
}
}
}
*/
t.Logf("call via micro drpc")
rsp, err = mdrpcsvc.Call(ctx, req)
if err != nil {
if rsp, err = mdrpcsvc.Call(ctx, &pb.CallReq{Req: "my_name"}); err != nil {
t.Logf("micro drpc err: %v", err)
// t.Fatal(err)
} else {

View File

@@ -8,6 +8,8 @@ package combo
//go:generate sh -c "protoc -I./proto -I. -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) --go-micro_out=components='micro|drpc',standalone=true,debug=true,paths=source_relative:./mdpb proto/test.proto"
//go:generate sh -c "protoc -I./proto -I. -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) --go-grpc_out=standalone=true,paths=source_relative:./ngpb proto/test.proto"
//go:generate sh -c "protoc -I./proto -I. -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) --go_out=paths=source_relative:./ngpb proto/test.proto"
//go:generate sh -c "protoc -I./proto -I. -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) --go-grpc_out=paths=source_relative:./ngpb proto/test.proto"
//go:generate sh -c "protoc -I./proto -I. -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) --go-drpc_out=standalone=true,json=false,paths=source_relative:./ndpb proto/test.proto"
//go:generate sh -c "protoc -I./proto -I. -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) --go_out=paths=source_relative:./ndpb proto/test.proto"
//go:generate sh -c "protoc -I./proto -I. -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) --go-drpc_out=json=false,paths=source_relative:./ndpb proto/test.proto"

View File

@@ -1,5 +1,7 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.5.3
// versions:
// - protoc-gen-go-micro v3.5.3
// - protoc v3.21.12
// source: test.proto
package pb

View File

@@ -23,7 +23,8 @@ func NewTestClient(name string, c client.Client) TestClient {
}
func (c *testClient) Call(ctx context.Context, req *proto.CallReq, opts ...client.CallOption) (*proto.CallRsp, error) {
opts = append(opts, client.WithRequestTimeout(time.Second*5))
td := time.Duration(5000000000)
opts = append(opts, client.WithRequestTimeout(td))
rsp := &proto.CallRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "test.v1.Test.Call", req), rsp, opts...)
if err != nil {
@@ -38,7 +39,8 @@ type testServer struct {
func (h *testServer) Call(ctx context.Context, req *proto.CallReq, rsp *proto.CallRsp) error {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, time.Second*5)
td := time.Duration(5000000000)
ctx, cancel = context.WithTimeout(ctx, td)
defer cancel()
return h.TestServer.Call(ctx, req, rsp)
}

View File

@@ -1,5 +1,7 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.5.3
// versions:
// - protoc-gen-go-micro v3.5.3
// - protoc v3.21.12
// source: test.proto
package pb

View File

@@ -23,7 +23,8 @@ func NewTestClient(name string, c client.Client) TestClient {
}
func (c *testClient) Call(ctx context.Context, req *proto.CallReq, opts ...client.CallOption) (*proto.CallRsp, error) {
opts = append(opts, client.WithRequestTimeout(time.Second*5))
td := time.Duration(5000000000)
opts = append(opts, client.WithRequestTimeout(td))
rsp := &proto.CallRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Test.Call", req), rsp, opts...)
if err != nil {
@@ -38,7 +39,8 @@ type testServer struct {
func (h *testServer) Call(ctx context.Context, req *proto.CallReq, rsp *proto.CallRsp) error {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, time.Second*5)
td := time.Duration(5000000000)
ctx, cancel = context.WithTimeout(ctx, td)
defer cancel()
return h.TestServer.Call(ctx, req, rsp)
}

View File

@@ -1,5 +1,7 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.5.3
// versions:
// - protoc-gen-go-micro v3.5.3
// - protoc v3.21.12
// source: test.proto
package pb

View File

@@ -35,7 +35,8 @@ func (c *testClient) Call(ctx context.Context, req *proto.CallReq, opts ...clien
v3.Path("/v1/call"),
v3.Body("*"),
)
opts = append(opts, client.WithRequestTimeout(time.Second*5))
td := time.Duration(5000000000)
opts = append(opts, client.WithRequestTimeout(td))
rsp := &proto.CallRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Test.Call", req), rsp, opts...)
if err != nil {
@@ -50,7 +51,8 @@ type testServer struct {
func (h *testServer) Call(ctx context.Context, req *proto.CallReq, rsp *proto.CallRsp) error {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, time.Second*5)
td := time.Duration(5000000000)
ctx, cancel = context.WithTimeout(ctx, td)
defer cancel()
return h.TestServer.Call(ctx, req, rsp)
}

View File

@@ -0,0 +1,286 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.21.12
// source: test.proto
package pb
import (
_ "go.unistack.org/micro-proto/v3/api"
_ "go.unistack.org/micro-proto/v3/openapiv3"
_ "go.unistack.org/micro-proto/v3/tag"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/known/wrapperspb"
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 CallReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Req string `protobuf:"bytes,1,opt,name=req,proto3" json:"req,omitempty"`
}
func (x *CallReq) Reset() {
*x = CallReq{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CallReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CallReq) ProtoMessage() {}
func (x *CallReq) 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 CallReq.ProtoReflect.Descriptor instead.
func (*CallReq) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{0}
}
func (x *CallReq) GetReq() string {
if x != nil {
return x.Req
}
return ""
}
type CallRsp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Rsp string `protobuf:"bytes,1,opt,name=rsp,proto3" json:"rsp,omitempty"`
}
func (x *CallRsp) Reset() {
*x = CallRsp{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CallRsp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CallRsp) ProtoMessage() {}
func (x *CallRsp) 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 CallRsp.ProtoReflect.Descriptor instead.
func (*CallRsp) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{1}
}
func (x *CallRsp) GetRsp() string {
if x != nil {
return x.Rsp
}
return ""
}
type Error struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Err string `protobuf:"bytes,1,opt,name=err,proto3" json:"err,omitempty"`
}
func (x *Error) Reset() {
*x = Error{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Error) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Error) ProtoMessage() {}
func (x *Error) 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 Error.ProtoReflect.Descriptor instead.
func (*Error) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{2}
}
func (x *Error) GetErr() string {
if x != nil {
return x.Err
}
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, 0x07, 0x74, 0x65,
0x73, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x0d, 0x74, 0x61, 0x67, 0x2f, 0x74, 0x61, 0x67, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x6f, 0x70, 0x65,
0x6e, 0x61, 0x70, 0x69, 0x76, 0x33, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65,
0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1b, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c,
0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x72, 0x65, 0x71, 0x22, 0x1b, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70,
0x12, 0x10, 0x0a, 0x03, 0x72, 0x73, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72,
0x73, 0x70, 0x22, 0x19, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x65,
0x72, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x72, 0x72, 0x32, 0x72, 0x0a,
0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x6a, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x10, 0x2e,
0x74, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a,
0x10, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73,
0x70, 0x22, 0x3e, 0xaa, 0x84, 0x9e, 0x03, 0x1c, 0x2a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x42, 0x14,
0x0a, 0x12, 0x12, 0x10, 0x0a, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x45,
0x72, 0x72, 0x6f, 0x72, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x0d, 0x22, 0x08, 0x2f, 0x76, 0x31, 0x2f,
0x63, 0x61, 0x6c, 0x6c, 0x3a, 0x01, 0x2a, 0xba, 0xea, 0xff, 0xf9, 0x01, 0x04, 0x0a, 0x02, 0x35,
0x73, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x6f, 0x2e, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b,
0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x73,
0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x62, 0x6f, 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, 3)
var file_test_proto_goTypes = []interface{}{
(*CallReq)(nil), // 0: test.v1.CallReq
(*CallRsp)(nil), // 1: test.v1.CallRsp
(*Error)(nil), // 2: test.v1.Error
}
var file_test_proto_depIdxs = []int32{
0, // 0: test.v1.Test.Call:input_type -> test.v1.CallReq
1, // 1: test.v1.Test.Call:output_type -> test.v1.CallRsp
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] 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.(*CallReq); 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.(*CallRsp); 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.(*Error); 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: 3,
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

@@ -1,5 +1,5 @@
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
// protoc-gen-go-drpc version: (devel)
// protoc-gen-go-drpc version: v0.0.32
// source: test.proto
package pb
@@ -7,7 +7,6 @@ package pb
import (
context "context"
errors "errors"
proto1 "go.unistack.org/micro-tests/server/combo/proto"
proto "google.golang.org/protobuf/proto"
drpc "storj.io/drpc"
drpcerr "storj.io/drpc/drpcerr"
@@ -30,7 +29,7 @@ func (drpcEncoding_File_test_proto) Unmarshal(buf []byte, msg drpc.Message) erro
type DRPCTestClient interface {
DRPCConn() drpc.Conn
Call(ctx context.Context, in *proto1.CallReq) (*proto1.CallRsp, error)
Call(ctx context.Context, in *CallReq) (*CallRsp, error)
}
type drpcTestClient struct {
@@ -43,8 +42,8 @@ func NewDRPCTestClient(cc drpc.Conn) DRPCTestClient {
func (c *drpcTestClient) DRPCConn() drpc.Conn { return c.cc }
func (c *drpcTestClient) Call(ctx context.Context, in *proto1.CallReq) (*proto1.CallRsp, error) {
out := new(proto1.CallRsp)
func (c *drpcTestClient) Call(ctx context.Context, in *CallReq) (*CallRsp, error) {
out := new(CallRsp)
err := c.cc.Invoke(ctx, "/test.v1.Test/Call", drpcEncoding_File_test_proto{}, in, out)
if err != nil {
return nil, err
@@ -53,12 +52,12 @@ func (c *drpcTestClient) Call(ctx context.Context, in *proto1.CallReq) (*proto1.
}
type DRPCTestServer interface {
Call(context.Context, *proto1.CallReq) (*proto1.CallRsp, error)
Call(context.Context, *CallReq) (*CallRsp, error)
}
type DRPCTestUnimplementedServer struct{}
func (s *DRPCTestUnimplementedServer) Call(context.Context, *proto1.CallReq) (*proto1.CallRsp, error) {
func (s *DRPCTestUnimplementedServer) Call(context.Context, *CallReq) (*CallRsp, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
@@ -74,7 +73,7 @@ func (DRPCTestDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver,
return srv.(DRPCTestServer).
Call(
ctx,
in1.(*proto1.CallReq),
in1.(*CallReq),
)
}, DRPCTestServer.Call, true
default:
@@ -88,14 +87,14 @@ func DRPCRegisterTest(mux drpc.Mux, impl DRPCTestServer) error {
type DRPCTest_CallStream interface {
drpc.Stream
SendAndClose(*proto1.CallRsp) error
SendAndClose(*CallRsp) error
}
type drpcTest_CallStream struct {
drpc.Stream
}
func (x *drpcTest_CallStream) SendAndClose(m *proto1.CallRsp) error {
func (x *drpcTest_CallStream) SendAndClose(m *CallRsp) error {
if err := x.MsgSend(m, drpcEncoding_File_test_proto{}); err != nil {
return err
}

View File

@@ -0,0 +1,286 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.21.12
// source: test.proto
package pb
import (
_ "go.unistack.org/micro-proto/v3/api"
_ "go.unistack.org/micro-proto/v3/openapiv3"
_ "go.unistack.org/micro-proto/v3/tag"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/known/wrapperspb"
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 CallReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Req string `protobuf:"bytes,1,opt,name=req,proto3" json:"req,omitempty"`
}
func (x *CallReq) Reset() {
*x = CallReq{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CallReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CallReq) ProtoMessage() {}
func (x *CallReq) 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 CallReq.ProtoReflect.Descriptor instead.
func (*CallReq) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{0}
}
func (x *CallReq) GetReq() string {
if x != nil {
return x.Req
}
return ""
}
type CallRsp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Rsp string `protobuf:"bytes,1,opt,name=rsp,proto3" json:"rsp,omitempty"`
}
func (x *CallRsp) Reset() {
*x = CallRsp{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CallRsp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CallRsp) ProtoMessage() {}
func (x *CallRsp) 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 CallRsp.ProtoReflect.Descriptor instead.
func (*CallRsp) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{1}
}
func (x *CallRsp) GetRsp() string {
if x != nil {
return x.Rsp
}
return ""
}
type Error struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Err string `protobuf:"bytes,1,opt,name=err,proto3" json:"err,omitempty"`
}
func (x *Error) Reset() {
*x = Error{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Error) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Error) ProtoMessage() {}
func (x *Error) 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 Error.ProtoReflect.Descriptor instead.
func (*Error) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{2}
}
func (x *Error) GetErr() string {
if x != nil {
return x.Err
}
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, 0x07, 0x74, 0x65,
0x73, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x0d, 0x74, 0x61, 0x67, 0x2f, 0x74, 0x61, 0x67, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x6f, 0x70, 0x65,
0x6e, 0x61, 0x70, 0x69, 0x76, 0x33, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65,
0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1b, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c,
0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x72, 0x65, 0x71, 0x22, 0x1b, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70,
0x12, 0x10, 0x0a, 0x03, 0x72, 0x73, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72,
0x73, 0x70, 0x22, 0x19, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x65,
0x72, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x72, 0x72, 0x32, 0x72, 0x0a,
0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x6a, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x10, 0x2e,
0x74, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a,
0x10, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73,
0x70, 0x22, 0x3e, 0xaa, 0x84, 0x9e, 0x03, 0x1c, 0x2a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x42, 0x14,
0x0a, 0x12, 0x12, 0x10, 0x0a, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x45,
0x72, 0x72, 0x6f, 0x72, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x0d, 0x22, 0x08, 0x2f, 0x76, 0x31, 0x2f,
0x63, 0x61, 0x6c, 0x6c, 0x3a, 0x01, 0x2a, 0xba, 0xea, 0xff, 0xf9, 0x01, 0x04, 0x0a, 0x02, 0x35,
0x73, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x6f, 0x2e, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b,
0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x73,
0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x62, 0x6f, 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, 3)
var file_test_proto_goTypes = []interface{}{
(*CallReq)(nil), // 0: test.v1.CallReq
(*CallRsp)(nil), // 1: test.v1.CallRsp
(*Error)(nil), // 2: test.v1.Error
}
var file_test_proto_depIdxs = []int32{
0, // 0: test.v1.Test.Call:input_type -> test.v1.CallReq
1, // 1: test.v1.Test.Call:output_type -> test.v1.CallRsp
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] 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.(*CallReq); 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.(*CallRsp); 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.(*Error); 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: 3,
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

@@ -1,14 +1,13 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.19.4
// - protoc v3.21.12
// source: test.proto
package pb
import (
context "context"
proto "go.unistack.org/micro-tests/server/combo/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@@ -23,8 +22,8 @@ const _ = grpc.SupportPackageIsVersion7
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type TestClient interface {
//option (micro.api.micro_service) = { client_wrappers: ["one","two"]; };
Call(ctx context.Context, in *proto.CallReq, opts ...grpc.CallOption) (*proto.CallRsp, error)
// option (micro.api.micro_service) = { client_wrappers: ["one","two"]; };
Call(ctx context.Context, in *CallReq, opts ...grpc.CallOption) (*CallRsp, error)
}
type testClient struct {
@@ -35,8 +34,8 @@ func NewTestClient(cc grpc.ClientConnInterface) TestClient {
return &testClient{cc}
}
func (c *testClient) Call(ctx context.Context, in *proto.CallReq, opts ...grpc.CallOption) (*proto.CallRsp, error) {
out := new(proto.CallRsp)
func (c *testClient) Call(ctx context.Context, in *CallReq, opts ...grpc.CallOption) (*CallRsp, error) {
out := new(CallRsp)
err := c.cc.Invoke(ctx, "/test.v1.Test/Call", in, out, opts...)
if err != nil {
return nil, err
@@ -48,8 +47,8 @@ func (c *testClient) Call(ctx context.Context, in *proto.CallReq, opts ...grpc.C
// All implementations must embed UnimplementedTestServer
// for forward compatibility
type TestServer interface {
//option (micro.api.micro_service) = { client_wrappers: ["one","two"]; };
Call(context.Context, *proto.CallReq) (*proto.CallRsp, error)
// option (micro.api.micro_service) = { client_wrappers: ["one","two"]; };
Call(context.Context, *CallReq) (*CallRsp, error)
mustEmbedUnimplementedTestServer()
}
@@ -57,7 +56,7 @@ type TestServer interface {
type UnimplementedTestServer struct {
}
func (UnimplementedTestServer) Call(context.Context, *proto.CallReq) (*proto.CallRsp, error) {
func (UnimplementedTestServer) Call(context.Context, *CallReq) (*CallRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Call not implemented")
}
func (UnimplementedTestServer) mustEmbedUnimplementedTestServer() {}
@@ -74,7 +73,7 @@ func RegisterTestServer(s grpc.ServiceRegistrar, srv TestServer) {
}
func _Test_Call_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(proto.CallReq)
in := new(CallReq)
if err := dec(in); err != nil {
return nil, err
}
@@ -86,7 +85,7 @@ func _Test_Call_Handler(srv interface{}, ctx context.Context, dec func(interface
FullMethod: "/test.v1.Test/Call",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TestServer).Call(ctx, req.(*proto.CallReq))
return srv.(TestServer).Call(ctx, req.(*CallReq))
}
return interceptor(ctx, in, info, handler)
}

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.19.4
// protoc v3.21.12
// source: test.proto
package pb
@@ -180,18 +180,18 @@ var file_test_proto_rawDesc = []byte{
0x52, 0x03, 0x72, 0x65, 0x71, 0x22, 0x1b, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70,
0x12, 0x10, 0x0a, 0x03, 0x72, 0x73, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72,
0x73, 0x70, 0x22, 0x19, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x65,
0x72, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x72, 0x72, 0x32, 0x70, 0x0a,
0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x68, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x10, 0x2e,
0x72, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x72, 0x72, 0x32, 0x72, 0x0a,
0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x6a, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x10, 0x2e,
0x74, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a,
0x10, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73,
0x70, 0x22, 0x3c, 0xaa, 0x84, 0x9e, 0x03, 0x1c, 0x2a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x42, 0x14,
0x70, 0x22, 0x3e, 0xaa, 0x84, 0x9e, 0x03, 0x1c, 0x2a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x42, 0x14,
0x0a, 0x12, 0x12, 0x10, 0x0a, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x45,
0x72, 0x72, 0x6f, 0x72, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x0d, 0x22, 0x08, 0x2f, 0x76, 0x31, 0x2f,
0x63, 0x61, 0x6c, 0x6c, 0x3a, 0x01, 0x2a, 0xba, 0xea, 0xff, 0xf9, 0x01, 0x02, 0x08, 0x05, 0x42,
0x33, 0x5a, 0x31, 0x67, 0x6f, 0x2e, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x6f,
0x72, 0x67, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x73,
0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x62, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x63, 0x61, 0x6c, 0x6c, 0x3a, 0x01, 0x2a, 0xba, 0xea, 0xff, 0xf9, 0x01, 0x04, 0x0a, 0x02, 0x35,
0x73, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x6f, 0x2e, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b,
0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x73,
0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x62, 0x6f, 0x2f, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@@ -23,7 +23,7 @@ service Test {
};
};
option (micro.api.http) = { post: "/v1/call"; body: "*"; };
option (micro.api.micro_method) = { timeout: 5; };
option (micro.api.micro_method) = { timeout: "5s"; };
};
};