add get card method
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-05-24 01:10:31 +07:00
parent 4bd82a34a1
commit 8fbeae6fc1
12 changed files with 685 additions and 137 deletions
+327 -55
View File
@@ -318,7 +318,7 @@ func (x *Product) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Product.ProtoReflect.Descriptor instead.
// Deprecated: Use product.ProtoReflect.Descriptor instead.
func (*Product) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{5}
}
@@ -1026,6 +1026,211 @@ func (x *OrderItem) GetCount() int64 {
return 0
}
type CardItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Article string `protobuf:"bytes,2,opt,name=article,proto3" json:"article,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
Uri string `protobuf:"bytes,4,opt,name=uri,proto3" json:"uri,omitempty"`
Images []string `protobuf:"bytes,5,rep,name=images,proto3" json:"images,omitempty"`
Unit string `protobuf:"bytes,8,opt,name=unit,proto3" json:"unit,omitempty"`
Inventory float64 `protobuf:"fixed64,9,opt,name=inventory,proto3" json:"inventory,omitempty"`
Count int64 `protobuf:"varint,10,opt,name=count,proto3" json:"count,omitempty"`
Amount int64 `protobuf:"varint,11,opt,name=amount,proto3" json:"amount,omitempty"`
}
func (x *CardItem) Reset() {
*x = CardItem{}
if protoimpl.UnsafeEnabled {
mi := &file_main_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CardItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CardItem) ProtoMessage() {}
func (x *CardItem) ProtoReflect() protoreflect.Message {
mi := &file_main_proto_msgTypes[18]
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 CardItem.ProtoReflect.Descriptor instead.
func (*CardItem) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{18}
}
func (x *CardItem) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *CardItem) GetArticle() string {
if x != nil {
return x.Article
}
return ""
}
func (x *CardItem) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *CardItem) GetUri() string {
if x != nil {
return x.Uri
}
return ""
}
func (x *CardItem) GetImages() []string {
if x != nil {
return x.Images
}
return nil
}
func (x *CardItem) GetUnit() string {
if x != nil {
return x.Unit
}
return ""
}
func (x *CardItem) GetInventory() float64 {
if x != nil {
return x.Inventory
}
return 0
}
func (x *CardItem) GetCount() int64 {
if x != nil {
return x.Count
}
return 0
}
func (x *CardItem) GetAmount() int64 {
if x != nil {
return x.Amount
}
return 0
}
type CardReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Items []*OrderItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
}
func (x *CardReq) Reset() {
*x = CardReq{}
if protoimpl.UnsafeEnabled {
mi := &file_main_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CardReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CardReq) ProtoMessage() {}
func (x *CardReq) ProtoReflect() protoreflect.Message {
mi := &file_main_proto_msgTypes[19]
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 CardReq.ProtoReflect.Descriptor instead.
func (*CardReq) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{19}
}
func (x *CardReq) GetItems() []*OrderItem {
if x != nil {
return x.Items
}
return nil
}
type CardRsp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Items []*CardItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
}
func (x *CardRsp) Reset() {
*x = CardRsp{}
if protoimpl.UnsafeEnabled {
mi := &file_main_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CardRsp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CardRsp) ProtoMessage() {}
func (x *CardRsp) ProtoReflect() protoreflect.Message {
mi := &file_main_proto_msgTypes[20]
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 CardRsp.ProtoReflect.Descriptor instead.
func (*CardRsp) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{20}
}
func (x *CardRsp) GetItems() []*CardItem {
if x != nil {
return x.Items
}
return nil
}
var File_main_proto protoreflect.FileDescriptor
var file_main_proto_rawDesc = []byte{
@@ -1123,37 +1328,61 @@ var file_main_proto_rawDesc = []byte{
0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f,
0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70,
0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0xbc,
0x03, 0x0a, 0x03, 0x43, 0x52, 0x4d, 0x12, 0x4f, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74,
0x61, 0x6c, 0x6f, 0x67, 0x12, 0x18, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d,
0x2e, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x15,
0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c,
0x6f, 0x67, 0x52, 0x73, 0x70, 0x22, 0x10, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x2f,
0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x50, 0x6f,
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e,
0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e,
0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x73, 0x70, 0x22, 0x17, 0x82, 0xd3,
0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x55, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64,
0x75, 0x63, 0x74, 0x12, 0x18, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e,
0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e,
0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
0x74, 0x52, 0x73, 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x70,
0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x64, 0x0a, 0x0e,
0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x12, 0x1c,
0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x72,
0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x63,
0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72,
0x75, 0x6d, 0x62, 0x73, 0x52, 0x73, 0x70, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12,
0x11, 0x2f, 0x62, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x2f, 0x7b, 0x69,
0x64, 0x7d, 0x12, 0x49, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x13, 0x2e, 0x63, 0x72,
0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71,
0x1a, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64,
0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x3a, 0x05, 0x6f,
0x72, 0x64, 0x65, 0x72, 0x22, 0x07, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x42, 0x0e, 0x92,
0x41, 0x00, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xd2,
0x01, 0x0a, 0x08, 0x43, 0x61, 0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61,
0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x72,
0x74, 0x69, 0x63, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69,
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x16, 0x0a, 0x06, 0x69,
0x6d, 0x61, 0x67, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x69, 0x6d, 0x61,
0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e,
0x74, 0x6f, 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x69, 0x6e, 0x76, 0x65,
0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a,
0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61,
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f,
0x75, 0x6e, 0x74, 0x22, 0x35, 0x0a, 0x07, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x2a,
0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49,
0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x34, 0x0a, 0x07, 0x43, 0x61,
0x72, 0x64, 0x52, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d,
0x2e, 0x43, 0x61, 0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73,
0x32, 0x85, 0x04, 0x0a, 0x03, 0x43, 0x52, 0x4d, 0x12, 0x4f, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x43,
0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x18, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63,
0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71,
0x1a, 0x15, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x74,
0x61, 0x6c, 0x6f, 0x67, 0x52, 0x73, 0x70, 0x22, 0x10, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0a, 0x12,
0x08, 0x2f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x47, 0x65, 0x74,
0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x2e, 0x63, 0x72, 0x61, 0x62,
0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72,
0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x73, 0x70, 0x22, 0x17,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x55, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x50, 0x72,
0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x18, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72,
0x6d, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a,
0x15, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x50, 0x72, 0x6f, 0x64,
0x75, 0x63, 0x74, 0x52, 0x73, 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e,
0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x64,
0x0a, 0x0e, 0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73,
0x12, 0x1c, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74,
0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x19,
0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x42, 0x72, 0x65, 0x61, 0x64,
0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x73, 0x70, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02,
0x13, 0x12, 0x11, 0x2f, 0x62, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x2f,
0x7b, 0x69, 0x64, 0x7d, 0x12, 0x49, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x13, 0x2e,
0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52,
0x65, 0x71, 0x1a, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f,
0x72, 0x64, 0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x3a,
0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x07, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x12,
0x47, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x43, 0x61, 0x72, 0x64, 0x12, 0x12, 0x2e, 0x63, 0x72, 0x61,
0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x12,
0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x72, 0x64, 0x52,
0x73, 0x70, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x3a, 0x05, 0x69, 0x74, 0x65, 0x6d,
0x73, 0x22, 0x05, 0x2f, 0x63, 0x61, 0x72, 0x64, 0x42, 0x0e, 0x92, 0x41, 0x00, 0x5a, 0x09, 0x70,
0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -1168,14 +1397,14 @@ func file_main_proto_rawDescGZIP() []byte {
return file_main_proto_rawDescData
}
var file_main_proto_msgTypes = make([]protoimpl.MessageInfo, 18)
var file_main_proto_msgTypes = make([]protoimpl.MessageInfo, 21)
var file_main_proto_goTypes = []interface{}{
(*GetCatalogReq)(nil), // 0: crabs.crm.GetCatalogReq
(*CatalogRsp)(nil), // 1: crabs.crm.CatalogRsp
(*Category)(nil), // 2: crabs.crm.Category
(*GetPositionsReq)(nil), // 3: crabs.crm.GetPositionsReq
(*PositionsRsp)(nil), // 4: crabs.crm.PositionsRsp
(*Product)(nil), // 5: crabs.crm.Product
(*Product)(nil), // 5: crabs.crm.product
(*GroupedProduct)(nil), // 6: crabs.crm.GroupedProduct
(*Variant)(nil), // 7: crabs.crm.Variant
(*Property)(nil), // 8: crabs.crm.Property
@@ -1188,34 +1417,41 @@ var file_main_proto_goTypes = []interface{}{
(*OrderRsp)(nil), // 15: crabs.crm.OrderRsp
(*Order)(nil), // 16: crabs.crm.Order
(*OrderItem)(nil), // 17: crabs.crm.OrderItem
(*CardItem)(nil), // 18: crabs.crm.CardItem
(*CardReq)(nil), // 19: crabs.crm.CardReq
(*CardRsp)(nil), // 20: crabs.crm.CardRsp
}
var file_main_proto_depIdxs = []int32{
2, // 0: crabs.crm.CatalogRsp.categories:type_name -> crabs.crm.Category
2, // 1: crabs.crm.Category.children:type_name -> crabs.crm.Category
5, // 2: crabs.crm.PositionsRsp.products:type_name -> crabs.crm.Product
6, // 3: crabs.crm.Product.grouped_products:type_name -> crabs.crm.GroupedProduct
7, // 4: crabs.crm.Product.variants:type_name -> crabs.crm.Variant
9, // 5: crabs.crm.Product.characteristics:type_name -> crabs.crm.Characteristic
5, // 2: crabs.crm.PositionsRsp.products:type_name -> crabs.crm.product
6, // 3: crabs.crm.product.grouped_products:type_name -> crabs.crm.GroupedProduct
7, // 4: crabs.crm.product.variants:type_name -> crabs.crm.Variant
9, // 5: crabs.crm.product.characteristics:type_name -> crabs.crm.Characteristic
8, // 6: crabs.crm.Variant.properties:type_name -> crabs.crm.Property
5, // 7: crabs.crm.ProductRsp.product:type_name -> crabs.crm.Product
5, // 7: crabs.crm.ProductRsp.product:type_name -> crabs.crm.product
2, // 8: crabs.crm.BreadcrumbsRsp.categories:type_name -> crabs.crm.Category
16, // 9: crabs.crm.OrderReq.order:type_name -> crabs.crm.Order
17, // 10: crabs.crm.Order.items:type_name -> crabs.crm.OrderItem
0, // 11: crabs.crm.CRM.GetCatalog:input_type -> crabs.crm.GetCatalogReq
3, // 12: crabs.crm.CRM.GetPositions:input_type -> crabs.crm.GetPositionsReq
10, // 13: crabs.crm.CRM.GetProduct:input_type -> crabs.crm.GetProductReq
12, // 14: crabs.crm.CRM.GetBreadcrumbs:input_type -> crabs.crm.GetBreadcrumbsReq
14, // 15: crabs.crm.CRM.Order:input_type -> crabs.crm.OrderReq
1, // 16: crabs.crm.CRM.GetCatalog:output_type -> crabs.crm.CatalogRsp
4, // 17: crabs.crm.CRM.GetPositions:output_type -> crabs.crm.PositionsRsp
11, // 18: crabs.crm.CRM.GetProduct:output_type -> crabs.crm.ProductRsp
13, // 19: crabs.crm.CRM.GetBreadcrumbs:output_type -> crabs.crm.BreadcrumbsRsp
15, // 20: crabs.crm.CRM.Order:output_type -> crabs.crm.OrderRsp
16, // [16:21] is the sub-list for method output_type
11, // [11:16] is the sub-list for method input_type
11, // [11:11] is the sub-list for extension type_name
11, // [11:11] is the sub-list for extension extendee
0, // [0:11] is the sub-list for field type_name
17, // 11: crabs.crm.CardReq.items:type_name -> crabs.crm.OrderItem
18, // 12: crabs.crm.CardRsp.items:type_name -> crabs.crm.CardItem
0, // 13: crabs.crm.CRM.GetCatalog:input_type -> crabs.crm.GetCatalogReq
3, // 14: crabs.crm.CRM.GetPositions:input_type -> crabs.crm.GetPositionsReq
10, // 15: crabs.crm.CRM.GetProduct:input_type -> crabs.crm.GetProductReq
12, // 16: crabs.crm.CRM.GetBreadcrumbs:input_type -> crabs.crm.GetBreadcrumbsReq
14, // 17: crabs.crm.CRM.Order:input_type -> crabs.crm.OrderReq
19, // 18: crabs.crm.CRM.GetCard:input_type -> crabs.crm.CardReq
1, // 19: crabs.crm.CRM.GetCatalog:output_type -> crabs.crm.CatalogRsp
4, // 20: crabs.crm.CRM.GetPositions:output_type -> crabs.crm.PositionsRsp
11, // 21: crabs.crm.CRM.GetProduct:output_type -> crabs.crm.ProductRsp
13, // 22: crabs.crm.CRM.GetBreadcrumbs:output_type -> crabs.crm.BreadcrumbsRsp
15, // 23: crabs.crm.CRM.Order:output_type -> crabs.crm.OrderRsp
20, // 24: crabs.crm.CRM.GetCard:output_type -> crabs.crm.CardRsp
19, // [19:25] is the sub-list for method output_type
13, // [13:19] is the sub-list for method input_type
13, // [13:13] is the sub-list for extension type_name
13, // [13:13] is the sub-list for extension extendee
0, // [0:13] is the sub-list for field type_name
}
func init() { file_main_proto_init() }
@@ -1440,6 +1676,42 @@ func file_main_proto_init() {
return nil
}
}
file_main_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CardItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_main_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CardReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_main_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CardRsp); 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{
@@ -1447,7 +1719,7 @@ func file_main_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_main_proto_rawDesc,
NumEnums: 0,
NumMessages: 18,
NumMessages: 21,
NumExtensions: 0,
NumServices: 1,
},
+77
View File
@@ -249,6 +249,32 @@ func local_request_CRM_Order_0(ctx context.Context, marshaler runtime.Marshaler,
}
func request_CRM_GetCard_0(ctx context.Context, marshaler runtime.Marshaler, client CRMClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq CardReq
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Items); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GetCard(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_CRM_GetCard_0(ctx context.Context, marshaler runtime.Marshaler, server CRMServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq CardReq
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Items); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GetCard(ctx, &protoReq)
return msg, metadata, err
}
// RegisterCRMHandlerServer registers the http handlers for service CRM to "mux".
// UnaryRPC :call CRMServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -380,6 +406,31 @@ func RegisterCRMHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
})
mux.Handle("POST", pattern_CRM_GetCard_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.crm.CRM/GetCard", runtime.WithHTTPPathPattern("/card"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_CRM_GetCard_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_CRM_GetCard_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -531,6 +582,28 @@ func RegisterCRMHandlerClient(ctx context.Context, mux *runtime.ServeMux, client
})
mux.Handle("POST", pattern_CRM_GetCard_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/crabs.crm.CRM/GetCard", runtime.WithHTTPPathPattern("/card"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_CRM_GetCard_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_CRM_GetCard_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -544,6 +617,8 @@ var (
pattern_CRM_GetBreadcrumbs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"breadcrumbs", "id"}, ""))
pattern_CRM_Order_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"orders"}, ""))
pattern_CRM_GetCard_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"card"}, ""))
)
var (
@@ -556,4 +631,6 @@ var (
forward_CRM_GetBreadcrumbs_0 = runtime.ForwardResponseMessage
forward_CRM_Order_0 = runtime.ForwardResponseMessage
forward_CRM_GetCard_0 = runtime.ForwardResponseMessage
)
+37
View File
@@ -24,6 +24,7 @@ const (
CRM_GetProduct_FullMethodName = "/crabs.crm.CRM/GetProduct"
CRM_GetBreadcrumbs_FullMethodName = "/crabs.crm.CRM/GetBreadcrumbs"
CRM_Order_FullMethodName = "/crabs.crm.CRM/Order"
CRM_GetCard_FullMethodName = "/crabs.crm.CRM/GetCard"
)
// CRMClient is the client API for CRM service.
@@ -35,6 +36,7 @@ type CRMClient interface {
GetProduct(ctx context.Context, in *GetProductReq, opts ...grpc.CallOption) (*ProductRsp, error)
GetBreadcrumbs(ctx context.Context, in *GetBreadcrumbsReq, opts ...grpc.CallOption) (*BreadcrumbsRsp, error)
Order(ctx context.Context, in *OrderReq, opts ...grpc.CallOption) (*OrderRsp, error)
GetCard(ctx context.Context, in *CardReq, opts ...grpc.CallOption) (*CardRsp, error)
}
type cRMClient struct {
@@ -90,6 +92,15 @@ func (c *cRMClient) Order(ctx context.Context, in *OrderReq, opts ...grpc.CallOp
return out, nil
}
func (c *cRMClient) GetCard(ctx context.Context, in *CardReq, opts ...grpc.CallOption) (*CardRsp, error) {
out := new(CardRsp)
err := c.cc.Invoke(ctx, CRM_GetCard_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// CRMServer is the server API for CRM service.
// All implementations must embed UnimplementedCRMServer
// for forward compatibility
@@ -99,6 +110,7 @@ type CRMServer interface {
GetProduct(context.Context, *GetProductReq) (*ProductRsp, error)
GetBreadcrumbs(context.Context, *GetBreadcrumbsReq) (*BreadcrumbsRsp, error)
Order(context.Context, *OrderReq) (*OrderRsp, error)
GetCard(context.Context, *CardReq) (*CardRsp, error)
mustEmbedUnimplementedCRMServer()
}
@@ -121,6 +133,9 @@ func (UnimplementedCRMServer) GetBreadcrumbs(context.Context, *GetBreadcrumbsReq
func (UnimplementedCRMServer) Order(context.Context, *OrderReq) (*OrderRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Order not implemented")
}
func (UnimplementedCRMServer) GetCard(context.Context, *CardReq) (*CardRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCard not implemented")
}
func (UnimplementedCRMServer) mustEmbedUnimplementedCRMServer() {}
// UnsafeCRMServer may be embedded to opt out of forward compatibility for this service.
@@ -224,6 +239,24 @@ func _CRM_Order_Handler(srv interface{}, ctx context.Context, dec func(interface
return interceptor(ctx, in, info, handler)
}
func _CRM_GetCard_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CardReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CRMServer).GetCard(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: CRM_GetCard_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CRMServer).GetCard(ctx, req.(*CardReq))
}
return interceptor(ctx, in, info, handler)
}
// CRM_ServiceDesc is the grpc.ServiceDesc for CRM service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -251,6 +284,10 @@ var CRM_ServiceDesc = grpc.ServiceDesc{
MethodName: "Order",
Handler: _CRM_Order_Handler,
},
{
MethodName: "GetCard",
Handler: _CRM_GetCard_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "main.proto",