update tests and go.mod

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-02-06 19:08:01 +03:00
parent ac192b7ef5
commit 025b34cb21
12 changed files with 1392 additions and 9 deletions

View File

@@ -0,0 +1,552 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0-devel
// protoc v3.6.1
// source: test.proto
package pb
import (
proto "github.com/golang/protobuf/proto"
wrappers "github.com/golang/protobuf/ptypes/wrappers"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
_ "google.golang.org/genproto/googleapis/api/annotations"
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)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type CallReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Req string `protobuf:"bytes,2,opt,name=req,proto3" json:"req,omitempty"`
Arg1 string `protobuf:"bytes,3,opt,name=arg1,proto3" json:"arg1,omitempty"`
Arg2 uint64 `protobuf:"varint,4,opt,name=arg2,proto3" json:"arg2,omitempty"`
Nested *Nested `protobuf:"bytes,5,opt,name=nested,proto3" json:"nested,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) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *CallReq) GetReq() string {
if x != nil {
return x.Req
}
return ""
}
func (x *CallReq) GetArg1() string {
if x != nil {
return x.Arg1
}
return ""
}
func (x *CallReq) GetArg2() uint64 {
if x != nil {
return x.Arg2
}
return 0
}
func (x *CallReq) GetNested() *Nested {
if x != nil {
return x.Nested
}
return nil
}
type Nested struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
StringArgs []string `protobuf:"bytes,1,rep,name=string_args,json=stringArgs,proto3" json:"string_args,omitempty"`
Uint64Args []*wrappers.UInt64Value `protobuf:"bytes,2,rep,name=uint64_args,json=uint64Args,proto3" json:"uint64_args,omitempty"`
}
func (x *Nested) Reset() {
*x = Nested{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Nested) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Nested) ProtoMessage() {}
func (x *Nested) 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 Nested.ProtoReflect.Descriptor instead.
func (*Nested) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{1}
}
func (x *Nested) GetStringArgs() []string {
if x != nil {
return x.StringArgs
}
return nil
}
func (x *Nested) GetUint64Args() []*wrappers.UInt64Value {
if x != nil {
return x.Uint64Args
}
return nil
}
type CallRsp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Rsp string `protobuf:"bytes,2,opt,name=rsp,proto3" json:"rsp,omitempty"`
}
func (x *CallRsp) Reset() {
*x = CallRsp{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[2]
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[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 CallRsp.ProtoReflect.Descriptor instead.
func (*CallRsp) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{2}
}
func (x *CallRsp) GetRsp() string {
if x != nil {
return x.Rsp
}
return ""
}
type CallReq1 struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Req string `protobuf:"bytes,2,opt,name=req,proto3" json:"req,omitempty"`
}
func (x *CallReq1) Reset() {
*x = CallReq1{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CallReq1) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CallReq1) ProtoMessage() {}
func (x *CallReq1) 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 CallReq1.ProtoReflect.Descriptor instead.
func (*CallReq1) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{3}
}
func (x *CallReq1) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *CallReq1) GetReq() string {
if x != nil {
return x.Req
}
return ""
}
type CallRsp1 struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Rsp string `protobuf:"bytes,2,opt,name=rsp,proto3" json:"rsp,omitempty"`
}
func (x *CallRsp1) Reset() {
*x = CallRsp1{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CallRsp1) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CallRsp1) ProtoMessage() {}
func (x *CallRsp1) 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 CallRsp1.ProtoReflect.Descriptor instead.
func (*CallRsp1) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{4}
}
func (x *CallRsp1) GetRsp() string {
if x != nil {
return x.Rsp
}
return ""
}
type Error struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
}
func (x *Error) Reset() {
*x = Error{}
if protoimpl.UnsafeEnabled {
mi := &file_test_proto_msgTypes[5]
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[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 Error.ProtoReflect.Descriptor instead.
func (*Error) Descriptor() ([]byte, []int) {
return file_test_proto_rawDescGZIP(), []int{5}
}
func (x *Error) GetMsg() string {
if x != nil {
return x.Msg
}
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, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61,
0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65,
0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 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, 0x7d, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
0x10, 0x0a, 0x03, 0x72, 0x65, 0x71, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x65,
0x71, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x31, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x61, 0x72, 0x67, 0x31, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x32, 0x18, 0x04, 0x20,
0x01, 0x28, 0x04, 0x52, 0x04, 0x61, 0x72, 0x67, 0x32, 0x12, 0x24, 0x0a, 0x06, 0x6e, 0x65, 0x73,
0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x74, 0x65, 0x73, 0x74,
0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x22,
0x68, 0x0a, 0x06, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x72,
0x69, 0x6e, 0x67, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a,
0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x67, 0x73, 0x12, 0x3d, 0x0a, 0x0b, 0x75, 0x69,
0x6e, 0x74, 0x36, 0x34, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x75,
0x69, 0x6e, 0x74, 0x36, 0x34, 0x41, 0x72, 0x67, 0x73, 0x22, 0x1b, 0x0a, 0x07, 0x43, 0x61, 0x6c,
0x6c, 0x52, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x73, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x03, 0x72, 0x73, 0x70, 0x22, 0x30, 0x0a, 0x08, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65,
0x71, 0x31, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x65, 0x71, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x65, 0x71, 0x22, 0x1c, 0x0a, 0x08, 0x43, 0x61, 0x6c, 0x6c,
0x52, 0x73, 0x70, 0x31, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x73, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x03, 0x72, 0x73, 0x70, 0x22, 0x19, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12,
0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73,
0x67, 0x32, 0x94, 0x02, 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x7c, 0x0a, 0x04, 0x43, 0x61,
0x6c, 0x6c, 0x12, 0x0d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65,
0x71, 0x1a, 0x0d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70,
0x22, 0x56, 0x92, 0x41, 0x34, 0x2a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x4a, 0x2c, 0x0a, 0x07, 0x64,
0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x21, 0x0a, 0x0e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x20,
0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0f, 0x0a, 0x0d, 0x1a, 0x0b, 0x2e, 0x74,
0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22,
0x14, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x63, 0x61, 0x6c, 0x6c, 0x2f, 0x7b,
0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x8d, 0x01, 0x0a, 0x09, 0x43, 0x61, 0x6c,
0x6c, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61,
0x6c, 0x6c, 0x52, 0x65, 0x71, 0x31, 0x1a, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61,
0x6c, 0x6c, 0x52, 0x73, 0x70, 0x31, 0x22, 0x60, 0x92, 0x41, 0x39, 0x2a, 0x09, 0x43, 0x61, 0x6c,
0x6c, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4a, 0x2c, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c,
0x74, 0x12, 0x21, 0x0a, 0x0e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x0f, 0x0a, 0x0d, 0x1a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45,
0x72, 0x72, 0x6f, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x22, 0x19, 0x2f, 0x76, 0x31, 0x2f,
0x74, 0x65, 0x73, 0x74, 0x2f, 0x63, 0x61, 0x6c, 0x6c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2f, 0x7b,
0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x01, 0x2a, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68,
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2d,
0x6f, 0x72, 0x67, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2f,
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x68, 0x74, 0x74, 0x70, 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, 6)
var file_test_proto_goTypes = []interface{}{
(*CallReq)(nil), // 0: test.CallReq
(*Nested)(nil), // 1: test.Nested
(*CallRsp)(nil), // 2: test.CallRsp
(*CallReq1)(nil), // 3: test.CallReq1
(*CallRsp1)(nil), // 4: test.CallRsp1
(*Error)(nil), // 5: test.Error
(*wrappers.UInt64Value)(nil), // 6: google.protobuf.UInt64Value
}
var file_test_proto_depIdxs = []int32{
1, // 0: test.CallReq.nested:type_name -> test.Nested
6, // 1: test.Nested.uint64_args:type_name -> google.protobuf.UInt64Value
0, // 2: test.Test.Call:input_type -> test.CallReq
3, // 3: test.Test.CallError:input_type -> test.CallReq1
2, // 4: test.Test.Call:output_type -> test.CallRsp
4, // 5: test.Test.CallError:output_type -> test.CallRsp1
4, // [4:6] is the sub-list for method output_type
2, // [2:4] 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.(*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.(*Nested); 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.(*CallRsp); 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.(*CallReq1); 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.(*CallRsp1); 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.(*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: 6,
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,76 @@
syntax = "proto3";
package test;
option go_package = "github.com/unistack-org/micro-tests/server/http/proto;pb";
import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "google/protobuf/wrappers.proto";
service Test {
rpc Call(CallReq) returns (CallRsp) {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
operation_id: "Call";
responses: {
key: "default";
value: {
description: "Error response";
schema: {
json_schema: {
ref: ".test.Error";
}
}
}
}
};
option (google.api.http) = { post: "/v1/test/call/{name}"; body: "*"; };
};
rpc CallError(CallReq1) returns (CallRsp1) {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
operation_id: "CallError";
responses: {
key: "default";
value: {
description: "Error response";
schema: {
json_schema: {
ref: ".test.Error";
}
}
}
}
};
option (google.api.http) = { post: "/v1/test/callerror/{name}"; body: "*"; };
};
};
message CallReq {
string name = 1;
string req = 2;
string arg1 = 3;
uint64 arg2 = 4;
Nested nested = 5;
};
message Nested {
repeated string string_args = 1;
repeated google.protobuf.UInt64Value uint64_args = 2;
}
message CallRsp {
string rsp = 2;
};
message CallReq1 {
string name = 1;
string req = 2;
};
message CallRsp1 {
string rsp = 2;
};
message Error {
string msg = 1;
};

View File

@@ -0,0 +1,126 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package pb
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// TestClient is the client API for Test service.
//
// 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 {
Call(ctx context.Context, in *CallReq, opts ...grpc.CallOption) (*CallRsp, error)
CallError(ctx context.Context, in *CallReq1, opts ...grpc.CallOption) (*CallRsp1, error)
}
type testClient struct {
cc grpc.ClientConnInterface
}
func NewTestClient(cc grpc.ClientConnInterface) TestClient {
return &testClient{cc}
}
func (c *testClient) Call(ctx context.Context, in *CallReq, opts ...grpc.CallOption) (*CallRsp, error) {
out := new(CallRsp)
err := c.cc.Invoke(ctx, "/test.Test/Call", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *testClient) CallError(ctx context.Context, in *CallReq1, opts ...grpc.CallOption) (*CallRsp1, error) {
out := new(CallRsp1)
err := c.cc.Invoke(ctx, "/test.Test/CallError", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// TestServer is the server API for Test service.
// All implementations must embed UnimplementedTestServer
// for forward compatibility
type TestServer interface {
Call(context.Context, *CallReq) (*CallRsp, error)
CallError(context.Context, *CallReq1) (*CallRsp1, error)
mustEmbedUnimplementedTestServer()
}
// UnimplementedTestServer must be embedded to have forward compatible implementations.
type UnimplementedTestServer struct {
}
func (*UnimplementedTestServer) Call(context.Context, *CallReq) (*CallRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Call not implemented")
}
func (*UnimplementedTestServer) CallError(context.Context, *CallReq1) (*CallRsp1, error) {
return nil, status.Errorf(codes.Unimplemented, "method CallError not implemented")
}
func (*UnimplementedTestServer) mustEmbedUnimplementedTestServer() {}
func RegisterTestServer(s *grpc.Server, srv TestServer) {
s.RegisterService(&_Test_serviceDesc, srv)
}
func _Test_Call_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CallReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TestServer).Call(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/test.Test/Call",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TestServer).Call(ctx, req.(*CallReq))
}
return interceptor(ctx, in, info, handler)
}
func _Test_CallError_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CallReq1)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TestServer).CallError(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/test.Test/CallError",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TestServer).CallError(ctx, req.(*CallReq1))
}
return interceptor(ctx, in, info, handler)
}
var _Test_serviceDesc = grpc.ServiceDesc{
ServiceName: "test.Test",
HandlerType: (*TestServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Call",
Handler: _Test_Call_Handler,
},
{
MethodName: "CallError",
Handler: _Test_CallError_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "test.proto",
}

View File

@@ -0,0 +1,47 @@
// Code generated by protoc-gen-micro
// source: test.proto
package pb
import (
"context"
micro_api "github.com/unistack-org/micro/v3/api"
micro_client "github.com/unistack-org/micro/v3/client"
)
// NewTestEndpoints provides api endpoints metdata for Test service
func NewTestEndpoints() []*micro_api.Endpoint {
endpoints := make([]*micro_api.Endpoint, 0, 2)
var endpoint *micro_api.Endpoint
endpoint = &micro_api.Endpoint{
Name: "Test.Call",
Path: []string{"/v1/test/call/{name}"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}
endpoints = append(endpoints, endpoint)
endpoint = &micro_api.Endpoint{
Name: "Test.CallError",
Path: []string{"/v1/test/callerror/{name}"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}
endpoints = append(endpoints, endpoint)
return endpoints
}
// TestService interface
type TestService interface {
Call(context.Context, *CallReq, ...micro_client.CallOption) (*CallRsp, error)
CallError(context.Context, *CallReq1, ...micro_client.CallOption) (*CallRsp1, error)
}
// Micro server stuff
// TestHandler server handler
type TestHandler interface {
Call(context.Context, *CallReq, *CallRsp) error
CallError(context.Context, *CallReq1, *CallRsp1) error
}

View File

@@ -0,0 +1,117 @@
// Code generated by protoc-gen-micro
// source: test.proto
package pb
import (
"context"
"fmt"
// "net/http"
micro_client_http "github.com/unistack-org/micro-client-http/v3"
micro_api "github.com/unistack-org/micro/v3/api"
micro_client "github.com/unistack-org/micro/v3/client"
micro_server "github.com/unistack-org/micro/v3/server"
)
var (
_ micro_server.Option
_ micro_client.Option
)
type testService struct {
c micro_client.Client
name string
}
// Micro client stuff
// NewTestService create new service client
func NewTestService(name string, c micro_client.Client) TestService {
return &testService{c: c, name: name}
}
func (c *testService) Call(ctx context.Context, req *CallReq, opts ...micro_client.CallOption) (*CallRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &Error{}
nopts := append(opts,
micro_client_http.Method("POST"),
micro_client_http.Path("/v1/test/call/{name}"),
micro_client_http.Body("*"),
micro_client_http.ErrorMap(errmap),
)
rsp := &CallRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Test.Call", req), rsp, nopts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *testService) CallError(ctx context.Context, req *CallReq1, opts ...micro_client.CallOption) (*CallRsp1, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &Error{}
nopts := append(opts,
micro_client_http.Method("POST"),
micro_client_http.Path("/v1/test/callerror/{name}"),
micro_client_http.Body("*"),
micro_client_http.ErrorMap(errmap),
)
rsp := &CallRsp1{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Test.CallError", req), rsp, nopts...)
if err != nil {
return nil, err
}
return rsp, nil
}
// Micro server stuff
type testHandler struct {
TestHandler
}
func (h *testHandler) Call(ctx context.Context, req *CallReq, rsp *CallRsp) error {
return h.TestHandler.Call(ctx, req, rsp)
}
/*
func (h *testHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
fmt.Printf("new request: %#+v\n", r)
// HANDLE ALL STUFF
}
*/
func (h *testHandler) CallError(ctx context.Context, req *CallReq1, rsp *CallRsp1) error {
return h.TestHandler.CallError(ctx, req, rsp)
}
/*
func (h *testHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
fmt.Printf("new request: %#+v\n", r)
// HANDLE ALL STUFF
}
*/
// Error method to satisfy error interface
func (e *Error) Error() string {
return fmt.Sprintf("%#v", e)
}
// RegisterTestHandler registers server handler
func RegisterTestHandler(s micro_server.Server, sh TestHandler, opts ...micro_server.HandlerOption) error {
type test interface {
Call(context.Context, *CallReq, *CallRsp) error
CallError(context.Context, *CallReq1, *CallRsp1) error
// ServeHTTP(http.ResponseWriter, *http.Request)
}
type Test struct {
test
}
h := &testHandler{sh}
for _, endpoint := range NewTestEndpoints() {
opts = append(opts, micro_api.WithEndpoint(endpoint))
}
return s.Handle(s.NewHandler(&Test{h}, opts...))
}