initial commit

This commit is contained in:
m.zare
2026-04-10 18:25:21 +03:30
commit 77ca6c34a3
263 changed files with 34470 additions and 0 deletions

View File

@@ -0,0 +1,379 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.11.2
// source: discount.proto
package discount
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)
)
type GetVendorDiscountRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Discounts []*GetVendorDiscountRequest_DiscountEntry `protobuf:"bytes,1,rep,name=discounts,proto3" json:"discounts,omitempty"`
}
func (x *GetVendorDiscountRequest) Reset() {
*x = GetVendorDiscountRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_discount_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetVendorDiscountRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetVendorDiscountRequest) ProtoMessage() {}
func (x *GetVendorDiscountRequest) ProtoReflect() protoreflect.Message {
mi := &file_discount_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 GetVendorDiscountRequest.ProtoReflect.Descriptor instead.
func (*GetVendorDiscountRequest) Descriptor() ([]byte, []int) {
return file_discount_proto_rawDescGZIP(), []int{0}
}
func (x *GetVendorDiscountRequest) GetDiscounts() []*GetVendorDiscountRequest_DiscountEntry {
if x != nil {
return x.Discounts
}
return nil
}
type GetVendorDiscountResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Discounts []*GetVendorDiscountResponse_DiscountEntry `protobuf:"bytes,1,rep,name=discounts,proto3" json:"discounts,omitempty"`
}
func (x *GetVendorDiscountResponse) Reset() {
*x = GetVendorDiscountResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_discount_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetVendorDiscountResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetVendorDiscountResponse) ProtoMessage() {}
func (x *GetVendorDiscountResponse) ProtoReflect() protoreflect.Message {
mi := &file_discount_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 GetVendorDiscountResponse.ProtoReflect.Descriptor instead.
func (*GetVendorDiscountResponse) Descriptor() ([]byte, []int) {
return file_discount_proto_rawDescGZIP(), []int{1}
}
func (x *GetVendorDiscountResponse) GetDiscounts() []*GetVendorDiscountResponse_DiscountEntry {
if x != nil {
return x.Discounts
}
return nil
}
type GetVendorDiscountRequest_DiscountEntry struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ProductId int32 `protobuf:"varint,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
VendorId int32 `protobuf:"varint,2,opt,name=vendor_id,json=vendorId,proto3" json:"vendor_id,omitempty"`
}
func (x *GetVendorDiscountRequest_DiscountEntry) Reset() {
*x = GetVendorDiscountRequest_DiscountEntry{}
if protoimpl.UnsafeEnabled {
mi := &file_discount_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetVendorDiscountRequest_DiscountEntry) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetVendorDiscountRequest_DiscountEntry) ProtoMessage() {}
func (x *GetVendorDiscountRequest_DiscountEntry) ProtoReflect() protoreflect.Message {
mi := &file_discount_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 GetVendorDiscountRequest_DiscountEntry.ProtoReflect.Descriptor instead.
func (*GetVendorDiscountRequest_DiscountEntry) Descriptor() ([]byte, []int) {
return file_discount_proto_rawDescGZIP(), []int{0, 0}
}
func (x *GetVendorDiscountRequest_DiscountEntry) GetProductId() int32 {
if x != nil {
return x.ProductId
}
return 0
}
func (x *GetVendorDiscountRequest_DiscountEntry) GetVendorId() int32 {
if x != nil {
return x.VendorId
}
return 0
}
type GetVendorDiscountResponse_DiscountEntry struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ProductId int32 `protobuf:"varint,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
VendorId int32 `protobuf:"varint,2,opt,name=vendor_id,json=vendorId,proto3" json:"vendor_id,omitempty"`
Percent float32 `protobuf:"fixed32,3,opt,name=percent,proto3" json:"percent,omitempty"`
}
func (x *GetVendorDiscountResponse_DiscountEntry) Reset() {
*x = GetVendorDiscountResponse_DiscountEntry{}
if protoimpl.UnsafeEnabled {
mi := &file_discount_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetVendorDiscountResponse_DiscountEntry) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetVendorDiscountResponse_DiscountEntry) ProtoMessage() {}
func (x *GetVendorDiscountResponse_DiscountEntry) ProtoReflect() protoreflect.Message {
mi := &file_discount_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 GetVendorDiscountResponse_DiscountEntry.ProtoReflect.Descriptor instead.
func (*GetVendorDiscountResponse_DiscountEntry) Descriptor() ([]byte, []int) {
return file_discount_proto_rawDescGZIP(), []int{1, 0}
}
func (x *GetVendorDiscountResponse_DiscountEntry) GetProductId() int32 {
if x != nil {
return x.ProductId
}
return 0
}
func (x *GetVendorDiscountResponse_DiscountEntry) GetVendorId() int32 {
if x != nil {
return x.VendorId
}
return 0
}
func (x *GetVendorDiscountResponse_DiscountEntry) GetPercent() float32 {
if x != nil {
return x.Percent
}
return 0
}
var File_discount_proto protoreflect.FileDescriptor
var file_discount_proto_rawDesc = []byte{
0x0a, 0x0e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x08, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xb7, 0x01, 0x0a, 0x18, 0x47,
0x65, 0x74, 0x56, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4e, 0x0a, 0x09, 0x64, 0x69, 0x73, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x64, 0x69, 0x73,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x44,
0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x44,
0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x64, 0x69,
0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x1a, 0x4b, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64,
0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x70, 0x72,
0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x76, 0x65, 0x6e, 0x64, 0x6f,
0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x76, 0x65, 0x6e, 0x64,
0x6f, 0x72, 0x49, 0x64, 0x22, 0xd3, 0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x56, 0x65, 0x6e, 0x64,
0x6f, 0x72, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x4f, 0x0a, 0x09, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x2e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x73, 0x1a, 0x65, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x69, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x49, 0x64,
0x12, 0x18, 0x0a, 0x07, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,
0x02, 0x52, 0x07, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x32, 0x6e, 0x0a, 0x08, 0x44, 0x69,
0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x62, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x56, 0x65, 0x6e,
0x64, 0x6f, 0x72, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12,
0x22, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x65,
0x6e, 0x64, 0x6f, 0x72, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x47,
0x65, 0x74, 0x56, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x03, 0x5a, 0x01, 0x2e, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_discount_proto_rawDescOnce sync.Once
file_discount_proto_rawDescData = file_discount_proto_rawDesc
)
func file_discount_proto_rawDescGZIP() []byte {
file_discount_proto_rawDescOnce.Do(func() {
file_discount_proto_rawDescData = protoimpl.X.CompressGZIP(file_discount_proto_rawDescData)
})
return file_discount_proto_rawDescData
}
var file_discount_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_discount_proto_goTypes = []interface{}{
(*GetVendorDiscountRequest)(nil), // 0: discount.GetVendorDiscountRequest
(*GetVendorDiscountResponse)(nil), // 1: discount.GetVendorDiscountResponse
(*GetVendorDiscountRequest_DiscountEntry)(nil), // 2: discount.GetVendorDiscountRequest.DiscountEntry
(*GetVendorDiscountResponse_DiscountEntry)(nil), // 3: discount.GetVendorDiscountResponse.DiscountEntry
}
var file_discount_proto_depIdxs = []int32{
2, // 0: discount.GetVendorDiscountRequest.discounts:type_name -> discount.GetVendorDiscountRequest.DiscountEntry
3, // 1: discount.GetVendorDiscountResponse.discounts:type_name -> discount.GetVendorDiscountResponse.DiscountEntry
0, // 2: discount.Discount.GetVendorDiscountInfo:input_type -> discount.GetVendorDiscountRequest
1, // 3: discount.Discount.GetVendorDiscountInfo:output_type -> discount.GetVendorDiscountResponse
3, // [3:4] is the sub-list for method output_type
2, // [2:3] 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_discount_proto_init() }
func file_discount_proto_init() {
if File_discount_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_discount_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetVendorDiscountRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_discount_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetVendorDiscountResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_discount_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetVendorDiscountRequest_DiscountEntry); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_discount_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetVendorDiscountResponse_DiscountEntry); 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_discount_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_discount_proto_goTypes,
DependencyIndexes: file_discount_proto_depIdxs,
MessageInfos: file_discount_proto_msgTypes,
}.Build()
File_discount_proto = out.File
file_discount_proto_rawDesc = nil
file_discount_proto_goTypes = nil
file_discount_proto_depIdxs = nil
}

View File

@@ -0,0 +1,26 @@
syntax = "proto3";
package discount;
// import "google/protobuf/empty.proto";
option go_package = ".";
service Discount {
rpc GetVendorDiscountInfo(GetVendorDiscountRequest) returns (GetVendorDiscountResponse) {}
}
message GetVendorDiscountRequest {
message DiscountEntry {
int32 product_id = 1;
int32 vendor_id = 2;
}
repeated DiscountEntry discounts = 1;
}
message GetVendorDiscountResponse {
message DiscountEntry {
int32 product_id = 1;
int32 vendor_id = 2;
float percent = 3;
}
repeated DiscountEntry discounts = 1;
}

View File

@@ -0,0 +1,105 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.11.2
// source: discount.proto
package discount
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
// DiscountClient is the client API for Discount 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 DiscountClient interface {
GetVendorDiscountInfo(ctx context.Context, in *GetVendorDiscountRequest, opts ...grpc.CallOption) (*GetVendorDiscountResponse, error)
}
type discountClient struct {
cc grpc.ClientConnInterface
}
func NewDiscountClient(cc grpc.ClientConnInterface) DiscountClient {
return &discountClient{cc}
}
func (c *discountClient) GetVendorDiscountInfo(ctx context.Context, in *GetVendorDiscountRequest, opts ...grpc.CallOption) (*GetVendorDiscountResponse, error) {
out := new(GetVendorDiscountResponse)
err := c.cc.Invoke(ctx, "/discount.Discount/GetVendorDiscountInfo", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// DiscountServer is the server API for Discount service.
// All implementations must embed UnimplementedDiscountServer
// for forward compatibility
type DiscountServer interface {
GetVendorDiscountInfo(context.Context, *GetVendorDiscountRequest) (*GetVendorDiscountResponse, error)
mustEmbedUnimplementedDiscountServer()
}
// UnimplementedDiscountServer must be embedded to have forward compatible implementations.
type UnimplementedDiscountServer struct {
}
func (UnimplementedDiscountServer) GetVendorDiscountInfo(context.Context, *GetVendorDiscountRequest) (*GetVendorDiscountResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetVendorDiscountInfo not implemented")
}
func (UnimplementedDiscountServer) mustEmbedUnimplementedDiscountServer() {}
// UnsafeDiscountServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to DiscountServer will
// result in compilation errors.
type UnsafeDiscountServer interface {
mustEmbedUnimplementedDiscountServer()
}
func RegisterDiscountServer(s grpc.ServiceRegistrar, srv DiscountServer) {
s.RegisterService(&Discount_ServiceDesc, srv)
}
func _Discount_GetVendorDiscountInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetVendorDiscountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DiscountServer).GetVendorDiscountInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/discount.Discount/GetVendorDiscountInfo",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DiscountServer).GetVendorDiscountInfo(ctx, req.(*GetVendorDiscountRequest))
}
return interceptor(ctx, in, info, handler)
}
// Discount_ServiceDesc is the grpc.ServiceDesc for Discount service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Discount_ServiceDesc = grpc.ServiceDesc{
ServiceName: "discount.Discount",
HandlerType: (*DiscountServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetVendorDiscountInfo",
Handler: _Discount_GetVendorDiscountInfo_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "discount.proto",
}