8 changed files with 559 additions and 4 deletions
@ -0,0 +1,260 @@ |
|||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
|
// versions:
|
||||
|
// protoc-gen-go v1.26.0
|
||||
|
// protoc v3.17.3
|
||||
|
// source: dtmcli/dtmcli.proto
|
||||
|
|
||||
|
package dtmcli |
||||
|
|
||||
|
import ( |
||||
|
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) |
||||
|
) |
||||
|
|
||||
|
// The request message containing the user's name.
|
||||
|
type DtmRequest struct { |
||||
|
state protoimpl.MessageState |
||||
|
sizeCache protoimpl.SizeCache |
||||
|
unknownFields protoimpl.UnknownFields |
||||
|
|
||||
|
Gid string `protobuf:"bytes,1,opt,name=Gid,proto3" json:"Gid,omitempty"` |
||||
|
TransType string `protobuf:"bytes,2,opt,name=TransType,proto3" json:"TransType,omitempty"` |
||||
|
QueryPrepared string `protobuf:"bytes,3,opt,name=QueryPrepared,proto3" json:"QueryPrepared,omitempty"` |
||||
|
Extra map[string]string `protobuf:"bytes,4,rep,name=Extra,proto3" json:"Extra,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` |
||||
|
AppData []byte `protobuf:"bytes,5,opt,name=AppData,proto3" json:"AppData,omitempty"` |
||||
|
} |
||||
|
|
||||
|
func (x *DtmRequest) Reset() { |
||||
|
*x = DtmRequest{} |
||||
|
if protoimpl.UnsafeEnabled { |
||||
|
mi := &file_dtmcli_dtmcli_proto_msgTypes[0] |
||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
|
ms.StoreMessageInfo(mi) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
func (x *DtmRequest) String() string { |
||||
|
return protoimpl.X.MessageStringOf(x) |
||||
|
} |
||||
|
|
||||
|
func (*DtmRequest) ProtoMessage() {} |
||||
|
|
||||
|
func (x *DtmRequest) ProtoReflect() protoreflect.Message { |
||||
|
mi := &file_dtmcli_dtmcli_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 DtmRequest.ProtoReflect.Descriptor instead.
|
||||
|
func (*DtmRequest) Descriptor() ([]byte, []int) { |
||||
|
return file_dtmcli_dtmcli_proto_rawDescGZIP(), []int{0} |
||||
|
} |
||||
|
|
||||
|
func (x *DtmRequest) GetGid() string { |
||||
|
if x != nil { |
||||
|
return x.Gid |
||||
|
} |
||||
|
return "" |
||||
|
} |
||||
|
|
||||
|
func (x *DtmRequest) GetTransType() string { |
||||
|
if x != nil { |
||||
|
return x.TransType |
||||
|
} |
||||
|
return "" |
||||
|
} |
||||
|
|
||||
|
func (x *DtmRequest) GetQueryPrepared() string { |
||||
|
if x != nil { |
||||
|
return x.QueryPrepared |
||||
|
} |
||||
|
return "" |
||||
|
} |
||||
|
|
||||
|
func (x *DtmRequest) GetExtra() map[string]string { |
||||
|
if x != nil { |
||||
|
return x.Extra |
||||
|
} |
||||
|
return nil |
||||
|
} |
||||
|
|
||||
|
func (x *DtmRequest) GetAppData() []byte { |
||||
|
if x != nil { |
||||
|
return x.AppData |
||||
|
} |
||||
|
return nil |
||||
|
} |
||||
|
|
||||
|
// The response message containing the greetings
|
||||
|
type DtmReply struct { |
||||
|
state protoimpl.MessageState |
||||
|
sizeCache protoimpl.SizeCache |
||||
|
unknownFields protoimpl.UnknownFields |
||||
|
|
||||
|
DtmResult string `protobuf:"bytes,1,opt,name=DtmResult,proto3" json:"DtmResult,omitempty"` |
||||
|
} |
||||
|
|
||||
|
func (x *DtmReply) Reset() { |
||||
|
*x = DtmReply{} |
||||
|
if protoimpl.UnsafeEnabled { |
||||
|
mi := &file_dtmcli_dtmcli_proto_msgTypes[1] |
||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
|
ms.StoreMessageInfo(mi) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
func (x *DtmReply) String() string { |
||||
|
return protoimpl.X.MessageStringOf(x) |
||||
|
} |
||||
|
|
||||
|
func (*DtmReply) ProtoMessage() {} |
||||
|
|
||||
|
func (x *DtmReply) ProtoReflect() protoreflect.Message { |
||||
|
mi := &file_dtmcli_dtmcli_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 DtmReply.ProtoReflect.Descriptor instead.
|
||||
|
func (*DtmReply) Descriptor() ([]byte, []int) { |
||||
|
return file_dtmcli_dtmcli_proto_rawDescGZIP(), []int{1} |
||||
|
} |
||||
|
|
||||
|
func (x *DtmReply) GetDtmResult() string { |
||||
|
if x != nil { |
||||
|
return x.DtmResult |
||||
|
} |
||||
|
return "" |
||||
|
} |
||||
|
|
||||
|
var File_dtmcli_dtmcli_proto protoreflect.FileDescriptor |
||||
|
|
||||
|
var file_dtmcli_dtmcli_proto_rawDesc = []byte{ |
||||
|
0x0a, 0x13, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2f, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, |
||||
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x22, 0xeb, 0x01, |
||||
|
0x0a, 0x0a, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, |
||||
|
0x47, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x47, 0x69, 0x64, 0x12, 0x1c, |
||||
|
0x0a, 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, |
||||
|
0x09, 0x52, 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0d, |
||||
|
0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x64, 0x18, 0x03, 0x20, |
||||
|
0x01, 0x28, 0x09, 0x52, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, |
||||
|
0x65, 0x64, 0x12, 0x33, 0x0a, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x18, 0x04, 0x20, 0x03, 0x28, |
||||
|
0x0b, 0x32, 0x1d, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x44, 0x74, 0x6d, 0x52, 0x65, |
||||
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, |
||||
|
0x52, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x70, 0x70, 0x44, 0x61, |
||||
|
0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x41, 0x70, 0x70, 0x44, 0x61, 0x74, |
||||
|
0x61, 0x1a, 0x38, 0x0a, 0x0a, 0x45, 0x78, 0x74, 0x72, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, |
||||
|
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, |
||||
|
0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, |
||||
|
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x28, 0x0a, 0x08, 0x44, |
||||
|
0x74, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x44, 0x74, 0x6d, 0x52, 0x65, |
||||
|
0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x44, 0x74, 0x6d, 0x52, |
||||
|
0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0x35, 0x0a, 0x03, 0x44, 0x74, 0x6d, 0x12, 0x2e, 0x0a, 0x04, |
||||
|
0x43, 0x61, 0x6c, 0x6c, 0x12, 0x12, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x44, 0x74, |
||||
|
0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, |
||||
|
0x69, 0x2e, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x1c, 0x5a, 0x1a, |
||||
|
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x65, 0x64, 0x66, 0x2f, |
||||
|
0x64, 0x74, 0x6d, 0x2f, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, |
||||
|
0x6f, 0x33, |
||||
|
} |
||||
|
|
||||
|
var ( |
||||
|
file_dtmcli_dtmcli_proto_rawDescOnce sync.Once |
||||
|
file_dtmcli_dtmcli_proto_rawDescData = file_dtmcli_dtmcli_proto_rawDesc |
||||
|
) |
||||
|
|
||||
|
func file_dtmcli_dtmcli_proto_rawDescGZIP() []byte { |
||||
|
file_dtmcli_dtmcli_proto_rawDescOnce.Do(func() { |
||||
|
file_dtmcli_dtmcli_proto_rawDescData = protoimpl.X.CompressGZIP(file_dtmcli_dtmcli_proto_rawDescData) |
||||
|
}) |
||||
|
return file_dtmcli_dtmcli_proto_rawDescData |
||||
|
} |
||||
|
|
||||
|
var file_dtmcli_dtmcli_proto_msgTypes = make([]protoimpl.MessageInfo, 3) |
||||
|
var file_dtmcli_dtmcli_proto_goTypes = []interface{}{ |
||||
|
(*DtmRequest)(nil), // 0: dtmcli.DtmRequest
|
||||
|
(*DtmReply)(nil), // 1: dtmcli.DtmReply
|
||||
|
nil, // 2: dtmcli.DtmRequest.ExtraEntry
|
||||
|
} |
||||
|
var file_dtmcli_dtmcli_proto_depIdxs = []int32{ |
||||
|
2, // 0: dtmcli.DtmRequest.Extra:type_name -> dtmcli.DtmRequest.ExtraEntry
|
||||
|
0, // 1: dtmcli.Dtm.Call:input_type -> dtmcli.DtmRequest
|
||||
|
1, // 2: dtmcli.Dtm.Call:output_type -> dtmcli.DtmReply
|
||||
|
2, // [2:3] is the sub-list for method output_type
|
||||
|
1, // [1:2] is the sub-list for method input_type
|
||||
|
1, // [1:1] is the sub-list for extension type_name
|
||||
|
1, // [1:1] is the sub-list for extension extendee
|
||||
|
0, // [0:1] is the sub-list for field type_name
|
||||
|
} |
||||
|
|
||||
|
func init() { file_dtmcli_dtmcli_proto_init() } |
||||
|
func file_dtmcli_dtmcli_proto_init() { |
||||
|
if File_dtmcli_dtmcli_proto != nil { |
||||
|
return |
||||
|
} |
||||
|
if !protoimpl.UnsafeEnabled { |
||||
|
file_dtmcli_dtmcli_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { |
||||
|
switch v := v.(*DtmRequest); i { |
||||
|
case 0: |
||||
|
return &v.state |
||||
|
case 1: |
||||
|
return &v.sizeCache |
||||
|
case 2: |
||||
|
return &v.unknownFields |
||||
|
default: |
||||
|
return nil |
||||
|
} |
||||
|
} |
||||
|
file_dtmcli_dtmcli_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { |
||||
|
switch v := v.(*DtmReply); 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_dtmcli_dtmcli_proto_rawDesc, |
||||
|
NumEnums: 0, |
||||
|
NumMessages: 3, |
||||
|
NumExtensions: 0, |
||||
|
NumServices: 1, |
||||
|
}, |
||||
|
GoTypes: file_dtmcli_dtmcli_proto_goTypes, |
||||
|
DependencyIndexes: file_dtmcli_dtmcli_proto_depIdxs, |
||||
|
MessageInfos: file_dtmcli_dtmcli_proto_msgTypes, |
||||
|
}.Build() |
||||
|
File_dtmcli_dtmcli_proto = out.File |
||||
|
file_dtmcli_dtmcli_proto_rawDesc = nil |
||||
|
file_dtmcli_dtmcli_proto_goTypes = nil |
||||
|
file_dtmcli_dtmcli_proto_depIdxs = nil |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
syntax = "proto3"; |
||||
|
|
||||
|
option go_package = "github.com/yedf/dtm/dtmcli"; |
||||
|
|
||||
|
package dtmcli; |
||||
|
|
||||
|
// The dtm service definition. |
||||
|
service Dtm { |
||||
|
rpc Call(DtmRequest) returns (DtmReply) {} |
||||
|
} |
||||
|
|
||||
|
// The request message containing the user's name. |
||||
|
message DtmRequest { |
||||
|
string Gid = 1; |
||||
|
string TransType = 2; |
||||
|
string QueryPrepared = 3; |
||||
|
string Method = 4; |
||||
|
map<string, string> Extra = 5; |
||||
|
bytes AppData = 6; |
||||
|
} |
||||
|
|
||||
|
// The response message containing the greetings |
||||
|
message DtmReply { |
||||
|
string DtmResult = 1; |
||||
|
string DtmMessage = 2; |
||||
|
} |
||||
@ -0,0 +1,101 @@ |
|||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
|
||||
|
package dtmcli |
||||
|
|
||||
|
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.
|
||||
|
// Requires gRPC-Go v1.32.0 or later.
|
||||
|
const _ = grpc.SupportPackageIsVersion7 |
||||
|
|
||||
|
// DtmClient is the client API for Dtm 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 DtmClient interface { |
||||
|
Call(ctx context.Context, in *DtmRequest, opts ...grpc.CallOption) (*DtmReply, error) |
||||
|
} |
||||
|
|
||||
|
type dtmClient struct { |
||||
|
cc grpc.ClientConnInterface |
||||
|
} |
||||
|
|
||||
|
func NewDtmClient(cc grpc.ClientConnInterface) DtmClient { |
||||
|
return &dtmClient{cc} |
||||
|
} |
||||
|
|
||||
|
func (c *dtmClient) Call(ctx context.Context, in *DtmRequest, opts ...grpc.CallOption) (*DtmReply, error) { |
||||
|
out := new(DtmReply) |
||||
|
err := c.cc.Invoke(ctx, "/dtmcli.Dtm/Call", in, out, opts...) |
||||
|
if err != nil { |
||||
|
return nil, err |
||||
|
} |
||||
|
return out, nil |
||||
|
} |
||||
|
|
||||
|
// DtmServer is the server API for Dtm service.
|
||||
|
// All implementations must embed UnimplementedDtmServer
|
||||
|
// for forward compatibility
|
||||
|
type DtmServer interface { |
||||
|
Call(context.Context, *DtmRequest) (*DtmReply, error) |
||||
|
mustEmbedUnimplementedDtmServer() |
||||
|
} |
||||
|
|
||||
|
// UnimplementedDtmServer must be embedded to have forward compatible implementations.
|
||||
|
type UnimplementedDtmServer struct { |
||||
|
} |
||||
|
|
||||
|
func (UnimplementedDtmServer) Call(context.Context, *DtmRequest) (*DtmReply, error) { |
||||
|
return nil, status.Errorf(codes.Unimplemented, "method Call not implemented") |
||||
|
} |
||||
|
func (UnimplementedDtmServer) mustEmbedUnimplementedDtmServer() {} |
||||
|
|
||||
|
// UnsafeDtmServer may be embedded to opt out of forward compatibility for this service.
|
||||
|
// Use of this interface is not recommended, as added methods to DtmServer will
|
||||
|
// result in compilation errors.
|
||||
|
type UnsafeDtmServer interface { |
||||
|
mustEmbedUnimplementedDtmServer() |
||||
|
} |
||||
|
|
||||
|
func RegisterDtmServer(s grpc.ServiceRegistrar, srv DtmServer) { |
||||
|
s.RegisterService(&Dtm_ServiceDesc, srv) |
||||
|
} |
||||
|
|
||||
|
func _Dtm_Call_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { |
||||
|
in := new(DtmRequest) |
||||
|
if err := dec(in); err != nil { |
||||
|
return nil, err |
||||
|
} |
||||
|
if interceptor == nil { |
||||
|
return srv.(DtmServer).Call(ctx, in) |
||||
|
} |
||||
|
info := &grpc.UnaryServerInfo{ |
||||
|
Server: srv, |
||||
|
FullMethod: "/dtmcli.Dtm/Call", |
||||
|
} |
||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) { |
||||
|
return srv.(DtmServer).Call(ctx, req.(*DtmRequest)) |
||||
|
} |
||||
|
return interceptor(ctx, in, info, handler) |
||||
|
} |
||||
|
|
||||
|
// Dtm_ServiceDesc is the grpc.ServiceDesc for Dtm service.
|
||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||
|
// and not to be introspected or modified (even as a copy)
|
||||
|
var Dtm_ServiceDesc = grpc.ServiceDesc{ |
||||
|
ServiceName: "dtmcli.Dtm", |
||||
|
HandlerType: (*DtmServer)(nil), |
||||
|
Methods: []grpc.MethodDesc{ |
||||
|
{ |
||||
|
MethodName: "Call", |
||||
|
Handler: _Dtm_Call_Handler, |
||||
|
}, |
||||
|
}, |
||||
|
Streams: []grpc.StreamDesc{}, |
||||
|
Metadata: "dtmcli/dtmcli.proto", |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
package dtmsvr |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
"log" |
||||
|
|
||||
|
pb "github.com/yedf/dtm/dtmcli" |
||||
|
) |
||||
|
|
||||
|
// server is used to implement helloworld.GreeterServer.
|
||||
|
type server struct { |
||||
|
pb.UnimplementedDtmServer |
||||
|
} |
||||
|
|
||||
|
// SayHello implements helloworld.GreeterServer
|
||||
|
func (s *server) Call(ctx context.Context, in *pb.DtmRequest) (*pb.DtmReply, error) { |
||||
|
log.Printf("Received: %v", in) |
||||
|
return &pb.DtmReply{}, nil |
||||
|
} |
||||
Loading…
Reference in new issue