@@ -2,10 +2,12 @@ package flow
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
httpcli "github.com/unistack-org/micro-client-http/v3"
|
||||
jsoncodec "github.com/unistack-org/micro-codec-json/v3"
|
||||
jsonpbcodec "github.com/unistack-org/micro-codec-jsonpb/v3"
|
||||
httpsrv "github.com/unistack-org/micro-server-http/v3"
|
||||
pb "github.com/unistack-org/micro-tests/flow/proto"
|
||||
@@ -21,7 +23,20 @@ import (
|
||||
|
||||
type handler struct{}
|
||||
|
||||
func (h *handler) DeleteUser(ctx context.Context, req *pb.DeleteUserReq, rsp *pb.DeleteUserRsp) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *handler) UpdateUser(ctx context.Context, req *pb.UpdateUserReq, rsp *pb.UpdateUserRsp) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *handler) MailUser(ctx context.Context, req *pb.MailUserReq, rsp *pb.MailUserRsp) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *handler) LookupUser(ctx context.Context, req *pb.LookupUserReq, rsp *pb.LookupUserRsp) error {
|
||||
rsp.Birthday = "31.07.1986"
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -29,9 +44,16 @@ func TestFlow(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
logger.DefaultLogger = logger.NewLogger(logger.WithLevel(logger.TraceLevel))
|
||||
logger.DefaultLogger = logger.NewLogger(logger.WithLevel(logger.DebugLevel))
|
||||
|
||||
s := store.DefaultStore
|
||||
if err := s.Init(store.Codec(jsoncodec.NewCodec())); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := s.Connect(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
c := client.NewClientCallOptions(
|
||||
httpcli.NewClient(
|
||||
client.ContentType("application/json"),
|
||||
@@ -54,6 +76,7 @@ func TestFlow(t *testing.T) {
|
||||
httpsrv.NewServer(
|
||||
server.Codec("application/json", jsonpbcodec.NewCodec()),
|
||||
server.Address("127.0.0.1:7989"),
|
||||
httpsrv.RegisterRPCHandler(true),
|
||||
),
|
||||
),
|
||||
micro.Context(ctx),
|
||||
@@ -81,7 +104,7 @@ func TestFlow(t *testing.T) {
|
||||
steps := []flow.Step{
|
||||
flow.NewCallStep("test", pb.TestServiceName, "LookupUser", flow.StepID("test.TestService.LookupUser")),
|
||||
flow.NewCallStep("test", pb.TestServiceName, "UpdateUser", flow.StepRequires("test.TestService.LookupUser")),
|
||||
flow.NewCallStep("test", pb.TestServiceName, "RemoveUser", flow.StepRequires("test.TestService.UpdateUser")),
|
||||
flow.NewCallStep("test", pb.TestServiceName, "DeleteUser", flow.StepRequires("test.TestService.UpdateUser")),
|
||||
flow.NewCallStep("test", pb.TestServiceName, "MailUser", flow.StepRequires("test.TestService.UpdateUser")),
|
||||
}
|
||||
w, err := f.WorkflowCreate(ctx, "test", steps...)
|
||||
@@ -89,11 +112,25 @@ func TestFlow(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
req := &pb.LookupUserReq{Name: "vtolstov"}
|
||||
id, err := w.Execute(ctx, req, flow.ExecuteTimeout(2*time.Second))
|
||||
req, err := jsonpbcodec.NewCodec().Marshal(&pb.LookupUserReq{Name: "vtolstov"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
t.Logf("execution id: %s", id)
|
||||
id, err := w.Execute(ctx, &flow.Message{Body: req}, flow.ExecuteTimeout(2*time.Second))
|
||||
keys, err := s.List(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
keys, err = store.NewNamespaceStore(s, filepath.Join("workflows", id)).List(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
keys, err = store.NewNamespaceStore(s, filepath.Join("steps", id)).List(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_ = keys
|
||||
t.Logf("execution id: %s, result: %v", id, err)
|
||||
|
||||
}
|
||||
|
@@ -24,6 +24,270 @@ const (
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type MailUserReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func (x *MailUserReq) Reset() {
|
||||
*x = MailUserReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_test_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *MailUserReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*MailUserReq) ProtoMessage() {}
|
||||
|
||||
func (x *MailUserReq) 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 MailUserReq.ProtoReflect.Descriptor instead.
|
||||
func (*MailUserReq) Descriptor() ([]byte, []int) {
|
||||
return file_test_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *MailUserReq) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type MailUserRsp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
|
||||
}
|
||||
|
||||
func (x *MailUserRsp) Reset() {
|
||||
*x = MailUserRsp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_test_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *MailUserRsp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*MailUserRsp) ProtoMessage() {}
|
||||
|
||||
func (x *MailUserRsp) 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 MailUserRsp.ProtoReflect.Descriptor instead.
|
||||
func (*MailUserRsp) Descriptor() ([]byte, []int) {
|
||||
return file_test_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *MailUserRsp) GetStatus() string {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type UpdateUserReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UpdateUserReq) Reset() {
|
||||
*x = UpdateUserReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_test_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UpdateUserReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateUserReq) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateUserReq) 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 UpdateUserReq.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateUserReq) Descriptor() ([]byte, []int) {
|
||||
return file_test_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *UpdateUserReq) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type UpdateUserRsp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *UpdateUserRsp) Reset() {
|
||||
*x = UpdateUserRsp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_test_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UpdateUserRsp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateUserRsp) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateUserRsp) 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 UpdateUserRsp.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateUserRsp) Descriptor() ([]byte, []int) {
|
||||
return file_test_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
type DeleteUserReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteUserReq) Reset() {
|
||||
*x = DeleteUserReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_test_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeleteUserReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteUserReq) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteUserReq) 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 DeleteUserReq.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteUserReq) Descriptor() ([]byte, []int) {
|
||||
return file_test_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *DeleteUserReq) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type DeleteUserRsp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *DeleteUserRsp) Reset() {
|
||||
*x = DeleteUserRsp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_test_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeleteUserRsp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteUserRsp) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteUserRsp) 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 DeleteUserRsp.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteUserRsp) Descriptor() ([]byte, []int) {
|
||||
return file_test_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
type LookupUserReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -35,7 +299,7 @@ type LookupUserReq struct {
|
||||
func (x *LookupUserReq) Reset() {
|
||||
*x = LookupUserReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_test_proto_msgTypes[0]
|
||||
mi := &file_test_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -48,7 +312,7 @@ func (x *LookupUserReq) String() string {
|
||||
func (*LookupUserReq) ProtoMessage() {}
|
||||
|
||||
func (x *LookupUserReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_test_proto_msgTypes[0]
|
||||
mi := &file_test_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -61,7 +325,7 @@ func (x *LookupUserReq) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use LookupUserReq.ProtoReflect.Descriptor instead.
|
||||
func (*LookupUserReq) Descriptor() ([]byte, []int) {
|
||||
return file_test_proto_rawDescGZIP(), []int{0}
|
||||
return file_test_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *LookupUserReq) GetName() string {
|
||||
@@ -82,7 +346,7 @@ type LookupUserRsp struct {
|
||||
func (x *LookupUserRsp) Reset() {
|
||||
*x = LookupUserRsp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_test_proto_msgTypes[1]
|
||||
mi := &file_test_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -95,7 +359,7 @@ func (x *LookupUserRsp) String() string {
|
||||
func (*LookupUserRsp) ProtoMessage() {}
|
||||
|
||||
func (x *LookupUserRsp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_test_proto_msgTypes[1]
|
||||
mi := &file_test_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -108,7 +372,7 @@ func (x *LookupUserRsp) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use LookupUserRsp.ProtoReflect.Descriptor instead.
|
||||
func (*LookupUserRsp) Descriptor() ([]byte, []int) {
|
||||
return file_test_proto_rawDescGZIP(), []int{1}
|
||||
return file_test_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *LookupUserRsp) GetBirthday() string {
|
||||
@@ -129,7 +393,7 @@ type Error struct {
|
||||
func (x *Error) Reset() {
|
||||
*x = Error{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_test_proto_msgTypes[2]
|
||||
mi := &file_test_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -142,7 +406,7 @@ func (x *Error) String() string {
|
||||
func (*Error) ProtoMessage() {}
|
||||
|
||||
func (x *Error) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_test_proto_msgTypes[2]
|
||||
mi := &file_test_proto_msgTypes[8]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -155,7 +419,7 @@ func (x *Error) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Error.ProtoReflect.Descriptor instead.
|
||||
func (*Error) Descriptor() ([]byte, []int) {
|
||||
return file_test_proto_rawDescGZIP(), []int{2}
|
||||
return file_test_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *Error) GetMsg() string {
|
||||
@@ -175,28 +439,68 @@ var file_test_proto_rawDesc = []byte{
|
||||
0x69, 0x76, 0x32, 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, 0x23, 0x0a, 0x0d, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x55,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x21, 0x0a, 0x0b, 0x4d, 0x61, 0x69, 0x6c, 0x55, 0x73, 0x65,
|
||||
0x72, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x25, 0x0a, 0x0b, 0x4d, 0x61, 0x69, 0x6c,
|
||||
0x55, 0x73, 0x65, 0x72, 0x52, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22,
|
||||
0x23, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73,
|
||||
0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x23, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55,
|
||||
0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x2b, 0x0a, 0x0d, 0x4c, 0x6f,
|
||||
0x6f, 0x6b, 0x75, 0x70, 0x55, 0x73, 0x65, 0x72, 0x52, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x62,
|
||||
0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62,
|
||||
0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 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, 0xab, 0x01, 0x0a, 0x0b, 0x54, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x12, 0x9b, 0x01, 0x0a, 0x0a, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x55, 0x73, 0x65,
|
||||
0x72, 0x12, 0x13, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x55,
|
||||
0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4c, 0x6f,
|
||||
0x6f, 0x6b, 0x75, 0x70, 0x55, 0x73, 0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x63, 0x92, 0x41, 0x3a,
|
||||
0x2a, 0x0a, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x55, 0x73, 0x65, 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, 0x18,
|
||||
0x12, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6c, 0x6f, 0x6f, 0x6b, 0x75,
|
||||
0x70, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0xba, 0xea, 0xff, 0xf9, 0x01, 0x02, 0x08, 0x05,
|
||||
0x42, 0x33, 0x5a, 0x31, 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, 0x66, 0x6c, 0x6f, 0x77, 0x2f, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x44, 0x65,
|
||||
0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x23, 0x0a, 0x0d, 0x4c,
|
||||
0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x22, 0x2b, 0x0a, 0x0d, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x55, 0x73, 0x65, 0x72, 0x52, 0x73,
|
||||
0x70, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 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, 0xec, 0x04, 0x0a, 0x0b, 0x54, 0x65, 0x73,
|
||||
0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x94, 0x01, 0x0a, 0x0a, 0x4c, 0x6f, 0x6f,
|
||||
0x6b, 0x75, 0x70, 0x55, 0x73, 0x65, 0x72, 0x12, 0x13, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4c,
|
||||
0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x74,
|
||||
0x65, 0x73, 0x74, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x55, 0x73, 0x65, 0x72, 0x52, 0x73,
|
||||
0x70, 0x22, 0x5c, 0x92, 0x41, 0x3a, 0x2a, 0x0a, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x55, 0x73,
|
||||
0x65, 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, 0x11, 0x12, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72,
|
||||
0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0xba, 0xea, 0xff, 0xf9, 0x01, 0x02, 0x08, 0x05, 0x12,
|
||||
0x97, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x13,
|
||||
0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72,
|
||||
0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74,
|
||||
0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x5f, 0x92, 0x41, 0x3a, 0x2a, 0x0a, 0x55,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 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, 0x14, 0x1a, 0x0f, 0x2f,
|
||||
0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x01,
|
||||
0x2a, 0xba, 0xea, 0xff, 0xf9, 0x01, 0x02, 0x08, 0x05, 0x12, 0x94, 0x01, 0x0a, 0x0a, 0x44, 0x65,
|
||||
0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x13, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e,
|
||||
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e,
|
||||
0x74, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52,
|
||||
0x73, 0x70, 0x22, 0x5c, 0x92, 0x41, 0x3a, 0x2a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55,
|
||||
0x73, 0x65, 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, 0x11, 0x2a, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65,
|
||||
0x72, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0xba, 0xea, 0xff, 0xf9, 0x01, 0x02, 0x08, 0x05,
|
||||
0x12, 0x94, 0x01, 0x0a, 0x08, 0x4d, 0x61, 0x69, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x12, 0x11, 0x2e,
|
||||
0x74, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x61, 0x69, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71,
|
||||
0x1a, 0x11, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x61, 0x69, 0x6c, 0x55, 0x73, 0x65, 0x72,
|
||||
0x52, 0x73, 0x70, 0x22, 0x62, 0x92, 0x41, 0x38, 0x2a, 0x08, 0x4d, 0x61, 0x69, 0x6c, 0x55, 0x73,
|
||||
0x65, 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, 0x19, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72,
|
||||
0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x6d, 0x61, 0x69, 0x6c, 0x3a, 0x01, 0x2a, 0xba,
|
||||
0xea, 0xff, 0xf9, 0x01, 0x02, 0x08, 0x05, 0x42, 0x33, 0x5a, 0x31, 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, 0x66,
|
||||
0x6c, 0x6f, 0x77, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -211,17 +515,29 @@ func file_test_proto_rawDescGZIP() []byte {
|
||||
return file_test_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_test_proto_goTypes = []interface{}{
|
||||
(*LookupUserReq)(nil), // 0: test.LookupUserReq
|
||||
(*LookupUserRsp)(nil), // 1: test.LookupUserRsp
|
||||
(*Error)(nil), // 2: test.Error
|
||||
(*MailUserReq)(nil), // 0: test.MailUserReq
|
||||
(*MailUserRsp)(nil), // 1: test.MailUserRsp
|
||||
(*UpdateUserReq)(nil), // 2: test.UpdateUserReq
|
||||
(*UpdateUserRsp)(nil), // 3: test.UpdateUserRsp
|
||||
(*DeleteUserReq)(nil), // 4: test.DeleteUserReq
|
||||
(*DeleteUserRsp)(nil), // 5: test.DeleteUserRsp
|
||||
(*LookupUserReq)(nil), // 6: test.LookupUserReq
|
||||
(*LookupUserRsp)(nil), // 7: test.LookupUserRsp
|
||||
(*Error)(nil), // 8: test.Error
|
||||
}
|
||||
var file_test_proto_depIdxs = []int32{
|
||||
0, // 0: test.TestService.LookupUser:input_type -> test.LookupUserReq
|
||||
1, // 1: test.TestService.LookupUser:output_type -> test.LookupUserRsp
|
||||
1, // [1:2] is the sub-list for method output_type
|
||||
0, // [0:1] is the sub-list for method input_type
|
||||
6, // 0: test.TestService.LookupUser:input_type -> test.LookupUserReq
|
||||
2, // 1: test.TestService.UpdateUser:input_type -> test.UpdateUserReq
|
||||
4, // 2: test.TestService.DeleteUser:input_type -> test.DeleteUserReq
|
||||
0, // 3: test.TestService.MailUser:input_type -> test.MailUserReq
|
||||
7, // 4: test.TestService.LookupUser:output_type -> test.LookupUserRsp
|
||||
3, // 5: test.TestService.UpdateUser:output_type -> test.UpdateUserRsp
|
||||
5, // 6: test.TestService.DeleteUser:output_type -> test.DeleteUserRsp
|
||||
1, // 7: test.TestService.MailUser:output_type -> test.MailUserRsp
|
||||
4, // [4:8] is the sub-list for method output_type
|
||||
0, // [0:4] 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
|
||||
@@ -234,7 +550,7 @@ func file_test_proto_init() {
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_test_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*LookupUserReq); i {
|
||||
switch v := v.(*MailUserReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -246,7 +562,7 @@ func file_test_proto_init() {
|
||||
}
|
||||
}
|
||||
file_test_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*LookupUserRsp); i {
|
||||
switch v := v.(*MailUserRsp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -258,6 +574,78 @@ func file_test_proto_init() {
|
||||
}
|
||||
}
|
||||
file_test_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UpdateUserReq); 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.(*UpdateUserRsp); 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.(*DeleteUserReq); 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.(*DeleteUserRsp); 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.(*LookupUserReq); 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.(*LookupUserRsp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_test_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Error); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -276,7 +664,7 @@ func file_test_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_test_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 3,
|
||||
NumMessages: 9,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
@@ -26,9 +26,87 @@ service TestService {
|
||||
}
|
||||
}
|
||||
};
|
||||
option (micro.api.http) = { get: "/v1/user/lookup/{name}"; };
|
||||
option (micro.api.http) = { get: "/v1/user/{name}"; };
|
||||
option (micro.api.micro_method) = { timeout: 5; };
|
||||
};
|
||||
rpc UpdateUser(UpdateUserReq) returns (UpdateUserRsp) {
|
||||
option (micro.openapiv2.openapiv2_operation) = {
|
||||
operation_id: "UpdateUser";
|
||||
responses: {
|
||||
key: "default";
|
||||
value: {
|
||||
description: "Error response";
|
||||
schema: {
|
||||
json_schema: {
|
||||
ref: ".test.Error";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
option (micro.api.http) = { put: "/v1/user/{name}"; body:"*"; };
|
||||
option (micro.api.micro_method) = { timeout: 5; };
|
||||
};
|
||||
rpc DeleteUser(DeleteUserReq) returns (DeleteUserRsp) {
|
||||
option (micro.openapiv2.openapiv2_operation) = {
|
||||
operation_id: "DeleteUser";
|
||||
responses: {
|
||||
key: "default";
|
||||
value: {
|
||||
description: "Error response";
|
||||
schema: {
|
||||
json_schema: {
|
||||
ref: ".test.Error";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
option (micro.api.http) = { delete: "/v1/user/{name}"; };
|
||||
option (micro.api.micro_method) = { timeout: 5; };
|
||||
};
|
||||
rpc MailUser(MailUserReq) returns (MailUserRsp) {
|
||||
option (micro.openapiv2.openapiv2_operation) = {
|
||||
operation_id: "MailUser";
|
||||
responses: {
|
||||
key: "default";
|
||||
value: {
|
||||
description: "Error response";
|
||||
schema: {
|
||||
json_schema: {
|
||||
ref: ".test.Error";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
option (micro.api.http) = { post: "/v1/user/{name}/mail"; body:"*"; };
|
||||
option (micro.api.micro_method) = { timeout: 5; };
|
||||
};
|
||||
};
|
||||
|
||||
message MailUserReq {
|
||||
string name = 1;
|
||||
};
|
||||
|
||||
message MailUserRsp {
|
||||
string status = 1;
|
||||
};
|
||||
|
||||
message UpdateUserReq {
|
||||
string name = 1;
|
||||
};
|
||||
|
||||
message UpdateUserRsp {
|
||||
|
||||
};
|
||||
|
||||
message DeleteUserReq {
|
||||
string name = 1;
|
||||
};
|
||||
|
||||
message DeleteUserRsp {
|
||||
|
||||
};
|
||||
|
||||
message LookupUserReq {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
||||
// protoc-gen-go-micro version: v3.4.1
|
||||
// protoc-gen-go-micro version: v3.4.2
|
||||
// source: test.proto
|
||||
|
||||
package pb
|
||||
@@ -16,10 +16,30 @@ var (
|
||||
TestServiceEndpoints = []api.Endpoint{
|
||||
api.Endpoint{
|
||||
Name: "TestService.LookupUser",
|
||||
Path: []string{"/v1/user/lookup/{name}"},
|
||||
Path: []string{"/v1/user/{name}"},
|
||||
Method: []string{"GET"},
|
||||
Handler: "rpc",
|
||||
},
|
||||
api.Endpoint{
|
||||
Name: "TestService.UpdateUser",
|
||||
Path: []string{"/v1/user/{name}"},
|
||||
Method: []string{"PUT"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
api.Endpoint{
|
||||
Name: "TestService.DeleteUser",
|
||||
Path: []string{"/v1/user/{name}"},
|
||||
Method: []string{"DELETE"},
|
||||
Handler: "rpc",
|
||||
},
|
||||
api.Endpoint{
|
||||
Name: "TestService.MailUser",
|
||||
Path: []string{"/v1/user/{name}/mail"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -29,8 +49,14 @@ func NewTestServiceEndpoints() []api.Endpoint {
|
||||
|
||||
type TestServiceClient interface {
|
||||
LookupUser(ctx context.Context, req *LookupUserReq, opts ...client.CallOption) (*LookupUserRsp, error)
|
||||
UpdateUser(ctx context.Context, req *UpdateUserReq, opts ...client.CallOption) (*UpdateUserRsp, error)
|
||||
DeleteUser(ctx context.Context, req *DeleteUserReq, opts ...client.CallOption) (*DeleteUserRsp, error)
|
||||
MailUser(ctx context.Context, req *MailUserReq, opts ...client.CallOption) (*MailUserRsp, error)
|
||||
}
|
||||
|
||||
type TestServiceServer interface {
|
||||
LookupUser(ctx context.Context, req *LookupUserReq, rsp *LookupUserRsp) error
|
||||
UpdateUser(ctx context.Context, req *UpdateUserReq, rsp *UpdateUserRsp) error
|
||||
DeleteUser(ctx context.Context, req *DeleteUserReq, rsp *DeleteUserRsp) error
|
||||
MailUser(ctx context.Context, req *MailUserReq, rsp *MailUserRsp) error
|
||||
}
|
||||
|
@@ -1,18 +1,17 @@
|
||||
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
||||
// protoc-gen-go-micro version: v3.4.1
|
||||
// protoc-gen-go-micro version: v3.4.2
|
||||
// source: test.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
http "net/http"
|
||||
time "time"
|
||||
|
||||
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"
|
||||
server "github.com/unistack-org/micro/v3/server"
|
||||
http "net/http"
|
||||
time "time"
|
||||
)
|
||||
|
||||
type testServiceClient struct {
|
||||
@@ -32,7 +31,7 @@ func (c *testServiceClient) LookupUser(ctx context.Context, req *LookupUserReq,
|
||||
)
|
||||
opts = append(opts,
|
||||
v3.Method(http.MethodGet),
|
||||
v3.Path("/v1/user/lookup/{name}"),
|
||||
v3.Path("/v1/user/{name}"),
|
||||
)
|
||||
opts = append(opts, client.WithRequestTimeout(time.Second*5))
|
||||
rsp := &LookupUserRsp{}
|
||||
@@ -43,6 +42,65 @@ func (c *testServiceClient) LookupUser(ctx context.Context, req *LookupUserReq,
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *testServiceClient) UpdateUser(ctx context.Context, req *UpdateUserReq, opts ...client.CallOption) (*UpdateUserRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &Error{}
|
||||
opts = append(opts,
|
||||
v3.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v3.Method(http.MethodPut),
|
||||
v3.Path("/v1/user/{name}"),
|
||||
v3.Body("*"),
|
||||
)
|
||||
opts = append(opts, client.WithRequestTimeout(time.Second*5))
|
||||
rsp := &UpdateUserRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.UpdateUser", req), rsp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *testServiceClient) DeleteUser(ctx context.Context, req *DeleteUserReq, opts ...client.CallOption) (*DeleteUserRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &Error{}
|
||||
opts = append(opts,
|
||||
v3.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v3.Method(http.MethodDelete),
|
||||
v3.Path("/v1/user/{name}"),
|
||||
)
|
||||
opts = append(opts, client.WithRequestTimeout(time.Second*5))
|
||||
rsp := &DeleteUserRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.DeleteUser", req), rsp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *testServiceClient) MailUser(ctx context.Context, req *MailUserReq, opts ...client.CallOption) (*MailUserRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &Error{}
|
||||
opts = append(opts,
|
||||
v3.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v3.Method(http.MethodPost),
|
||||
v3.Path("/v1/user/{name}/mail"),
|
||||
v3.Body("*"),
|
||||
)
|
||||
opts = append(opts, client.WithRequestTimeout(time.Second*5))
|
||||
rsp := &MailUserRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.MailUser", req), rsp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
type testServiceServer struct {
|
||||
TestServiceServer
|
||||
}
|
||||
@@ -54,9 +112,33 @@ func (h *testServiceServer) LookupUser(ctx context.Context, req *LookupUserReq,
|
||||
return h.TestServiceServer.LookupUser(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func (h *testServiceServer) UpdateUser(ctx context.Context, req *UpdateUserReq, rsp *UpdateUserRsp) error {
|
||||
var cancel context.CancelFunc
|
||||
ctx, cancel = context.WithTimeout(ctx, time.Second*5)
|
||||
defer cancel()
|
||||
return h.TestServiceServer.UpdateUser(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func (h *testServiceServer) DeleteUser(ctx context.Context, req *DeleteUserReq, rsp *DeleteUserRsp) error {
|
||||
var cancel context.CancelFunc
|
||||
ctx, cancel = context.WithTimeout(ctx, time.Second*5)
|
||||
defer cancel()
|
||||
return h.TestServiceServer.DeleteUser(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func (h *testServiceServer) MailUser(ctx context.Context, req *MailUserReq, rsp *MailUserRsp) error {
|
||||
var cancel context.CancelFunc
|
||||
ctx, cancel = context.WithTimeout(ctx, time.Second*5)
|
||||
defer cancel()
|
||||
return h.TestServiceServer.MailUser(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func RegisterTestServiceServer(s server.Server, sh TestServiceServer, opts ...server.HandlerOption) error {
|
||||
type testService interface {
|
||||
LookupUser(ctx context.Context, req *LookupUserReq, rsp *LookupUserRsp) error
|
||||
UpdateUser(ctx context.Context, req *UpdateUserReq, rsp *UpdateUserRsp) error
|
||||
DeleteUser(ctx context.Context, req *DeleteUserReq, rsp *DeleteUserRsp) error
|
||||
MailUser(ctx context.Context, req *MailUserReq, rsp *MailUserRsp) error
|
||||
}
|
||||
type TestService struct {
|
||||
testService
|
||||
|
Reference in New Issue
Block a user