Add gRPC server implementation and database integration for marketplace and products
This commit is contained in:
200
api/generated/v1/marketplace/marketplace.pb.go
Normal file
200
api/generated/v1/marketplace/marketplace.pb.go
Normal file
@@ -0,0 +1,200 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc v6.31.0
|
||||
// source: marketplace/marketplace.proto
|
||||
|
||||
package marketplace
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
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 GetMarketplaceByIdRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
MarketplaceId uint64 `protobuf:"varint,1,opt,name=marketplace_id,json=marketplaceId,proto3" json:"marketplace_id,omitempty"` // ID of the marketplace to retrieve
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetMarketplaceByIdRequest) Reset() {
|
||||
*x = GetMarketplaceByIdRequest{}
|
||||
mi := &file_marketplace_marketplace_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetMarketplaceByIdRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetMarketplaceByIdRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetMarketplaceByIdRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_marketplace_marketplace_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetMarketplaceByIdRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetMarketplaceByIdRequest) Descriptor() ([]byte, []int) {
|
||||
return file_marketplace_marketplace_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *GetMarketplaceByIdRequest) GetMarketplaceId() uint64 {
|
||||
if x != nil {
|
||||
return x.MarketplaceId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Marketplace struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
BaseMarketplace uint32 `protobuf:"varint,2,opt,name=base_marketplace,json=baseMarketplace,proto3" json:"base_marketplace,omitempty"` // ID of the base marketplace
|
||||
AuthData string `protobuf:"bytes,3,opt,name=auth_data,json=authData,proto3" json:"auth_data,omitempty"` // Authentication data for the marketplace
|
||||
WarehouseId string `protobuf:"bytes,4,opt,name=warehouse_id,json=warehouseId,proto3" json:"warehouse_id,omitempty"` // ID of the warehouse associated with the marketplace
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Marketplace) Reset() {
|
||||
*x = Marketplace{}
|
||||
mi := &file_marketplace_marketplace_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Marketplace) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Marketplace) ProtoMessage() {}
|
||||
|
||||
func (x *Marketplace) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_marketplace_marketplace_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Marketplace.ProtoReflect.Descriptor instead.
|
||||
func (*Marketplace) Descriptor() ([]byte, []int) {
|
||||
return file_marketplace_marketplace_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *Marketplace) GetId() uint64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Marketplace) GetBaseMarketplace() uint32 {
|
||||
if x != nil {
|
||||
return x.BaseMarketplace
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Marketplace) GetAuthData() string {
|
||||
if x != nil {
|
||||
return x.AuthData
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Marketplace) GetWarehouseId() string {
|
||||
if x != nil {
|
||||
return x.WarehouseId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_marketplace_marketplace_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_marketplace_marketplace_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x1dmarketplace/marketplace.proto\x12\vmarketplace\"B\n" +
|
||||
"\x19GetMarketplaceByIdRequest\x12%\n" +
|
||||
"\x0emarketplace_id\x18\x01 \x01(\x04R\rmarketplaceId\"\x88\x01\n" +
|
||||
"\vMarketplace\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x04R\x02id\x12)\n" +
|
||||
"\x10base_marketplace\x18\x02 \x01(\rR\x0fbaseMarketplace\x12\x1b\n" +
|
||||
"\tauth_data\x18\x03 \x01(\tR\bauthData\x12!\n" +
|
||||
"\fwarehouse_id\x18\x04 \x01(\tR\vwarehouseId2l\n" +
|
||||
"\x12MarketplaceService\x12V\n" +
|
||||
"\x12GetMarketplaceById\x12&.marketplace.GetMarketplaceByIdRequest\x1a\x18.marketplace.MarketplaceB\x0fZ\r./marketplaceb\x06proto3"
|
||||
|
||||
var (
|
||||
file_marketplace_marketplace_proto_rawDescOnce sync.Once
|
||||
file_marketplace_marketplace_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_marketplace_marketplace_proto_rawDescGZIP() []byte {
|
||||
file_marketplace_marketplace_proto_rawDescOnce.Do(func() {
|
||||
file_marketplace_marketplace_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_marketplace_marketplace_proto_rawDesc), len(file_marketplace_marketplace_proto_rawDesc)))
|
||||
})
|
||||
return file_marketplace_marketplace_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_marketplace_marketplace_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_marketplace_marketplace_proto_goTypes = []any{
|
||||
(*GetMarketplaceByIdRequest)(nil), // 0: marketplace.GetMarketplaceByIdRequest
|
||||
(*Marketplace)(nil), // 1: marketplace.Marketplace
|
||||
}
|
||||
var file_marketplace_marketplace_proto_depIdxs = []int32{
|
||||
0, // 0: marketplace.MarketplaceService.GetMarketplaceById:input_type -> marketplace.GetMarketplaceByIdRequest
|
||||
1, // 1: marketplace.MarketplaceService.GetMarketplaceById:output_type -> marketplace.Marketplace
|
||||
1, // [1:2] is the sub-list for method output_type
|
||||
0, // [0:1] 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
|
||||
}
|
||||
|
||||
func init() { file_marketplace_marketplace_proto_init() }
|
||||
func file_marketplace_marketplace_proto_init() {
|
||||
if File_marketplace_marketplace_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_marketplace_marketplace_proto_rawDesc), len(file_marketplace_marketplace_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_marketplace_marketplace_proto_goTypes,
|
||||
DependencyIndexes: file_marketplace_marketplace_proto_depIdxs,
|
||||
MessageInfos: file_marketplace_marketplace_proto_msgTypes,
|
||||
}.Build()
|
||||
File_marketplace_marketplace_proto = out.File
|
||||
file_marketplace_marketplace_proto_goTypes = nil
|
||||
file_marketplace_marketplace_proto_depIdxs = nil
|
||||
}
|
||||
121
api/generated/v1/marketplace/marketplace_grpc.pb.go
Normal file
121
api/generated/v1/marketplace/marketplace_grpc.pb.go
Normal file
@@ -0,0 +1,121 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v6.31.0
|
||||
// source: marketplace/marketplace.proto
|
||||
|
||||
package marketplace
|
||||
|
||||
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.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
MarketplaceService_GetMarketplaceById_FullMethodName = "/marketplace.MarketplaceService/GetMarketplaceById"
|
||||
)
|
||||
|
||||
// MarketplaceServiceClient is the client API for MarketplaceService 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 MarketplaceServiceClient interface {
|
||||
GetMarketplaceById(ctx context.Context, in *GetMarketplaceByIdRequest, opts ...grpc.CallOption) (*Marketplace, error)
|
||||
}
|
||||
|
||||
type marketplaceServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewMarketplaceServiceClient(cc grpc.ClientConnInterface) MarketplaceServiceClient {
|
||||
return &marketplaceServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *marketplaceServiceClient) GetMarketplaceById(ctx context.Context, in *GetMarketplaceByIdRequest, opts ...grpc.CallOption) (*Marketplace, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Marketplace)
|
||||
err := c.cc.Invoke(ctx, MarketplaceService_GetMarketplaceById_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MarketplaceServiceServer is the server API for MarketplaceService service.
|
||||
// All implementations must embed UnimplementedMarketplaceServiceServer
|
||||
// for forward compatibility.
|
||||
type MarketplaceServiceServer interface {
|
||||
GetMarketplaceById(context.Context, *GetMarketplaceByIdRequest) (*Marketplace, error)
|
||||
mustEmbedUnimplementedMarketplaceServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedMarketplaceServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedMarketplaceServiceServer struct{}
|
||||
|
||||
func (UnimplementedMarketplaceServiceServer) GetMarketplaceById(context.Context, *GetMarketplaceByIdRequest) (*Marketplace, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMarketplaceById not implemented")
|
||||
}
|
||||
func (UnimplementedMarketplaceServiceServer) mustEmbedUnimplementedMarketplaceServiceServer() {}
|
||||
func (UnimplementedMarketplaceServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeMarketplaceServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to MarketplaceServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeMarketplaceServiceServer interface {
|
||||
mustEmbedUnimplementedMarketplaceServiceServer()
|
||||
}
|
||||
|
||||
func RegisterMarketplaceServiceServer(s grpc.ServiceRegistrar, srv MarketplaceServiceServer) {
|
||||
// If the following call pancis, it indicates UnimplementedMarketplaceServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&MarketplaceService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _MarketplaceService_GetMarketplaceById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetMarketplaceByIdRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MarketplaceServiceServer).GetMarketplaceById(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: MarketplaceService_GetMarketplaceById_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MarketplaceServiceServer).GetMarketplaceById(ctx, req.(*GetMarketplaceByIdRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// MarketplaceService_ServiceDesc is the grpc.ServiceDesc for MarketplaceService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var MarketplaceService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "marketplace.MarketplaceService",
|
||||
HandlerType: (*MarketplaceServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetMarketplaceById",
|
||||
Handler: _MarketplaceService_GetMarketplaceById_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "marketplace/marketplace.proto",
|
||||
}
|
||||
Reference in New Issue
Block a user