Documentation ¶
Index ¶
- Constants
- Variables
- func GeneratePointToGeoFromFloat64(latitude float64, longitude float64) string
- func RegisterHotelsServiceServer(s *grpc.Server, srv HotelsServiceServer)
- type Application
- type Consumer
- type ConsumerImpl
- func (c *ConsumerImpl) AddConsumer(consumer *Consumer)
- func (c *ConsumerImpl) CloseChannels()
- func (c *ConsumerImpl) CreateExchangeAndQueue(exchangeName, queueName, bindingKey string) (*amqp.Channel, error)
- func (c *ConsumerImpl) Dial() error
- func (c *ConsumerImpl) Initialize() error
- func (c *ConsumerImpl) RunConsumers(ctx context.Context, cancel context.CancelFunc)
- type CreateHotelRequest
- func (*CreateHotelRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateHotelRequest) GetCity() string
- func (x *CreateHotelRequest) GetCommentsCount() int64
- func (x *CreateHotelRequest) GetCountry() string
- func (x *CreateHotelRequest) GetDescription() string
- func (x *CreateHotelRequest) GetEmail() string
- func (x *CreateHotelRequest) GetImage() string
- func (x *CreateHotelRequest) GetLatitude() float64
- func (x *CreateHotelRequest) GetLocation() string
- func (x *CreateHotelRequest) GetLongitude() float64
- func (x *CreateHotelRequest) GetName() string
- func (x *CreateHotelRequest) GetPhotos() []string
- func (x *CreateHotelRequest) GetRating() float64
- func (*CreateHotelRequest) ProtoMessage()
- func (x *CreateHotelRequest) ProtoReflect() protoreflect.Message
- func (x *CreateHotelRequest) Reset()
- func (x *CreateHotelRequest) String() string
- type CreateHotelResponse
- func (*CreateHotelResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CreateHotelResponse) GetHotel() *Hotel
- func (*CreateHotelResponse) ProtoMessage()
- func (x *CreateHotelResponse) ProtoReflect() protoreflect.Message
- func (x *CreateHotelResponse) Reset()
- func (x *CreateHotelResponse) String() string
- type GRPCServer
- func (h *GRPCServer) CreateHotel(ctx context.Context, req *CreateHotelRequest) (*CreateHotelResponse, error)
- func (h *GRPCServer) GetHotelByID(ctx context.Context, req *GetByIDRequest) (*GetByIDResponse, error)
- func (h *GRPCServer) GetHotels(ctx context.Context, req *GetHotelsRequest) (*GetHotelsResponse, error)
- func (h *GRPCServer) UpdateHotel(ctx context.Context, req *UpdateHotelRequest) (*UpdateHotelResponse, error)
- func (h *GRPCServer) UploadImage(ctx context.Context, req *UploadImageRequest) (*UploadImageResponse, error)
- type GetByIDRequest
- type GetByIDResponse
- type GetHotelsRequest
- func (*GetHotelsRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetHotelsRequest) GetPage() int64
- func (x *GetHotelsRequest) GetSize() int64
- func (*GetHotelsRequest) ProtoMessage()
- func (x *GetHotelsRequest) ProtoReflect() protoreflect.Message
- func (x *GetHotelsRequest) Reset()
- func (x *GetHotelsRequest) String() string
- type GetHotelsResponse
- func (*GetHotelsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GetHotelsResponse) GetHasMore() bool
- func (x *GetHotelsResponse) GetHotels() []*Hotel
- func (x *GetHotelsResponse) GetPage() int64
- func (x *GetHotelsResponse) GetSize() int64
- func (x *GetHotelsResponse) GetTotalCount() int64
- func (x *GetHotelsResponse) GetTotalPages() int64
- func (*GetHotelsResponse) ProtoMessage()
- func (x *GetHotelsResponse) ProtoReflect() protoreflect.Message
- func (x *GetHotelsResponse) Reset()
- func (x *GetHotelsResponse) String() string
- type Hotel
- func (*Hotel) Descriptor() ([]byte, []int)deprecated
- func (x *Hotel) GetCity() string
- func (x *Hotel) GetCommentsCount() int64
- func (x *Hotel) GetCountry() string
- func (x *Hotel) GetCreatedAt() *timestamp.Timestamp
- func (x *Hotel) GetDescription() string
- func (x *Hotel) GetEmail() string
- func (x *Hotel) GetHotelID() string
- func (x *Hotel) GetImage() string
- func (x *Hotel) GetLatitude() float64
- func (x *Hotel) GetLocation() string
- func (x *Hotel) GetLongitude() float64
- func (x *Hotel) GetName() string
- func (x *Hotel) GetPhotos() []string
- func (x *Hotel) GetRating() float64
- func (x *Hotel) GetUpdatedAt() *timestamp.Timestamp
- func (*Hotel) ProtoMessage()
- func (x *Hotel) ProtoReflect() protoreflect.Message
- func (x *Hotel) Reset()
- func (x *Hotel) String() string
- type HotelDO
- type HotelsServiceClient
- type HotelsServiceServer
- type List
- type Publisher
- type PublisherImpl
- type Repository
- type RepositoryImpl
- func (h *RepositoryImpl) CreateHotel(ctx context.Context, hotel *HotelDO) (*HotelDO, error)
- func (h *RepositoryImpl) GetHotelByID(ctx context.Context, hotelID uuid.UUID) (*HotelDO, error)
- func (h *RepositoryImpl) GetHotels(ctx context.Context, query *pagination.Pagination) (*List, error)
- func (h *RepositoryImpl) UpdateHotel(ctx context.Context, hotel *HotelDO) (*HotelDO, error)
- func (h *RepositoryImpl) UpdateHotelImage(ctx context.Context, hotelID uuid.UUID, imageURL string) error
- type Service
- type ServiceImpl
- func (h *ServiceImpl) CreateHotel(ctx context.Context, hotel *HotelDO) (*HotelDO, error)
- func (h *ServiceImpl) GetHotelByID(ctx context.Context, hotelID uuid.UUID) (*HotelDO, error)
- func (h *ServiceImpl) GetHotels(ctx context.Context, query *pagination.Pagination) (*List, error)
- func (h *ServiceImpl) UpdateHotel(ctx context.Context, hotel *HotelDO) (*HotelDO, error)
- func (h *ServiceImpl) UpdateHotelImage(ctx context.Context, delivery amqp.Delivery) error
- func (h *ServiceImpl) UploadImage(ctx context.Context, msg *UploadHotelImageMsg) error
- type UnimplementedHotelsServiceServer
- func (*UnimplementedHotelsServiceServer) CreateHotel(context.Context, *CreateHotelRequest) (*CreateHotelResponse, error)
- func (*UnimplementedHotelsServiceServer) GetHotelByID(context.Context, *GetByIDRequest) (*GetByIDResponse, error)
- func (*UnimplementedHotelsServiceServer) GetHotels(context.Context, *GetHotelsRequest) (*GetHotelsResponse, error)
- func (*UnimplementedHotelsServiceServer) UpdateHotel(context.Context, *UpdateHotelRequest) (*UpdateHotelResponse, error)
- func (*UnimplementedHotelsServiceServer) UploadImage(context.Context, *UploadImageRequest) (*UploadImageResponse, error)
- type UpdateHotelImageMsg
- type UpdateHotelRequest
- func (*UpdateHotelRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateHotelRequest) GetCity() string
- func (x *UpdateHotelRequest) GetCommentsCount() int64
- func (x *UpdateHotelRequest) GetCountry() string
- func (x *UpdateHotelRequest) GetDescription() string
- func (x *UpdateHotelRequest) GetEmail() string
- func (x *UpdateHotelRequest) GetHotelID() string
- func (x *UpdateHotelRequest) GetImage() string
- func (x *UpdateHotelRequest) GetLatitude() float64
- func (x *UpdateHotelRequest) GetLocation() string
- func (x *UpdateHotelRequest) GetLongitude() float64
- func (x *UpdateHotelRequest) GetName() string
- func (x *UpdateHotelRequest) GetPhotos() []string
- func (x *UpdateHotelRequest) GetRating() float64
- func (*UpdateHotelRequest) ProtoMessage()
- func (x *UpdateHotelRequest) ProtoReflect() protoreflect.Message
- func (x *UpdateHotelRequest) Reset()
- func (x *UpdateHotelRequest) String() string
- type UpdateHotelResponse
- func (*UpdateHotelResponse) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateHotelResponse) GetHotel() *Hotel
- func (*UpdateHotelResponse) ProtoMessage()
- func (x *UpdateHotelResponse) ProtoReflect() protoreflect.Message
- func (x *UpdateHotelResponse) Reset()
- func (x *UpdateHotelResponse) String() string
- type UploadHotelImageMsg
- type UploadImageRequest
- func (*UploadImageRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UploadImageRequest) GetContentType() string
- func (x *UploadImageRequest) GetData() []byte
- func (x *UploadImageRequest) GetHotelID() string
- func (*UploadImageRequest) ProtoMessage()
- func (x *UploadImageRequest) ProtoReflect() protoreflect.Message
- func (x *UploadImageRequest) Reset()
- func (x *UploadImageRequest) String() string
- type UploadImageResponse
- func (*UploadImageResponse) Descriptor() ([]byte, []int)deprecated
- func (x *UploadImageResponse) GetHotelID() string
- func (*UploadImageResponse) ProtoMessage()
- func (x *UploadImageResponse) ProtoReflect() protoreflect.Message
- func (x *UploadImageResponse) Reset()
- func (x *UploadImageResponse) String() string
Constants ¶
const ( ExchangeName = "hotels" UpdateImageQueue = "update_hotel_image" UpdateImageBindingKey = "update_hotel_image_key" UpdateImageWorkers = 5 UpdateImageConsumerTag = "update_hotel_image_consumer" )
Variables ¶
var ( ErrInvalidUUID = errors.New("invalid uuid") ErrInvalidDeliveryHeaders = errors.New("invalid delivery headers") ErrInternalServerError = errors.New("internal server error") ErrInvalidImageFormat = errors.New("invalid file format") ErrHotelNotFound = errors.New("hotel not found") )
var File_app_hotels_hotels_proto protoreflect.FileDescriptor
Functions ¶
func RegisterHotelsServiceServer ¶
func RegisterHotelsServiceServer(s *grpc.Server, srv HotelsServiceServer)
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func NewApplication ¶
func (*Application) Run ¶
func (s *Application) Run() error
type ConsumerImpl ¶
type ConsumerImpl struct {
// contains filtered or unexported fields
}
func NewHotelsConsumer ¶
func (*ConsumerImpl) AddConsumer ¶
func (c *ConsumerImpl) AddConsumer(consumer *Consumer)
func (*ConsumerImpl) CloseChannels ¶
func (c *ConsumerImpl) CloseChannels()
CloseChannels close active channels
func (*ConsumerImpl) CreateExchangeAndQueue ¶
func (c *ConsumerImpl) CreateExchangeAndQueue(exchangeName, queueName, bindingKey string) (*amqp.Channel, error)
func (*ConsumerImpl) Dial ¶
func (c *ConsumerImpl) Dial() error
func (*ConsumerImpl) Initialize ¶
func (c *ConsumerImpl) Initialize() error
func (*ConsumerImpl) RunConsumers ¶
func (c *ConsumerImpl) RunConsumers(ctx context.Context, cancel context.CancelFunc)
type CreateHotelRequest ¶
type CreateHotelRequest struct { Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` Email string `protobuf:"bytes,2,opt,name=Email,proto3" json:"Email,omitempty"` Country string `protobuf:"bytes,3,opt,name=Country,proto3" json:"Country,omitempty"` City string `protobuf:"bytes,4,opt,name=City,proto3" json:"City,omitempty"` Description string `protobuf:"bytes,5,opt,name=Description,proto3" json:"Description,omitempty"` Location string `protobuf:"bytes,6,opt,name=Location,proto3" json:"Location,omitempty"` Image string `protobuf:"bytes,8,opt,name=Image,proto3" json:"Image,omitempty"` Photos []string `protobuf:"bytes,9,rep,name=Photos,proto3" json:"Photos,omitempty"` CommentsCount int64 `protobuf:"varint,10,opt,name=CommentsCount,proto3" json:"CommentsCount,omitempty"` Rating float64 `protobuf:"fixed64,7,opt,name=Rating,proto3" json:"Rating,omitempty"` Latitude float64 `protobuf:"fixed64,11,opt,name=Latitude,proto3" json:"Latitude,omitempty"` Longitude float64 `protobuf:"fixed64,12,opt,name=Longitude,proto3" json:"Longitude,omitempty"` // contains filtered or unexported fields }
func (*CreateHotelRequest) Descriptor
deprecated
func (*CreateHotelRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateHotelRequest.ProtoReflect.Descriptor instead.
func (*CreateHotelRequest) GetCity ¶
func (x *CreateHotelRequest) GetCity() string
func (*CreateHotelRequest) GetCommentsCount ¶
func (x *CreateHotelRequest) GetCommentsCount() int64
func (*CreateHotelRequest) GetCountry ¶
func (x *CreateHotelRequest) GetCountry() string
func (*CreateHotelRequest) GetDescription ¶
func (x *CreateHotelRequest) GetDescription() string
func (*CreateHotelRequest) GetEmail ¶
func (x *CreateHotelRequest) GetEmail() string
func (*CreateHotelRequest) GetImage ¶
func (x *CreateHotelRequest) GetImage() string
func (*CreateHotelRequest) GetLatitude ¶
func (x *CreateHotelRequest) GetLatitude() float64
func (*CreateHotelRequest) GetLocation ¶
func (x *CreateHotelRequest) GetLocation() string
func (*CreateHotelRequest) GetLongitude ¶
func (x *CreateHotelRequest) GetLongitude() float64
func (*CreateHotelRequest) GetName ¶
func (x *CreateHotelRequest) GetName() string
func (*CreateHotelRequest) GetPhotos ¶
func (x *CreateHotelRequest) GetPhotos() []string
func (*CreateHotelRequest) GetRating ¶
func (x *CreateHotelRequest) GetRating() float64
func (*CreateHotelRequest) ProtoMessage ¶
func (*CreateHotelRequest) ProtoMessage()
func (*CreateHotelRequest) ProtoReflect ¶
func (x *CreateHotelRequest) ProtoReflect() protoreflect.Message
func (*CreateHotelRequest) Reset ¶
func (x *CreateHotelRequest) Reset()
func (*CreateHotelRequest) String ¶
func (x *CreateHotelRequest) String() string
type CreateHotelResponse ¶
type CreateHotelResponse struct { Hotel *Hotel `protobuf:"bytes,1,opt,name=Hotel,proto3" json:"Hotel,omitempty"` // contains filtered or unexported fields }
func (*CreateHotelResponse) Descriptor
deprecated
func (*CreateHotelResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateHotelResponse.ProtoReflect.Descriptor instead.
func (*CreateHotelResponse) GetHotel ¶
func (x *CreateHotelResponse) GetHotel() *Hotel
func (*CreateHotelResponse) ProtoMessage ¶
func (*CreateHotelResponse) ProtoMessage()
func (*CreateHotelResponse) ProtoReflect ¶
func (x *CreateHotelResponse) ProtoReflect() protoreflect.Message
func (*CreateHotelResponse) Reset ¶
func (x *CreateHotelResponse) Reset()
func (*CreateHotelResponse) String ¶
func (x *CreateHotelResponse) String() string
type GRPCServer ¶
type GRPCServer struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(service Service, logger logger.Logger, validate *validator.Validate) GRPCServer
func (*GRPCServer) CreateHotel ¶
func (h *GRPCServer) CreateHotel(ctx context.Context, req *CreateHotelRequest) (*CreateHotelResponse, error)
func (*GRPCServer) GetHotelByID ¶
func (h *GRPCServer) GetHotelByID(ctx context.Context, req *GetByIDRequest) (*GetByIDResponse, error)
func (*GRPCServer) GetHotels ¶
func (h *GRPCServer) GetHotels(ctx context.Context, req *GetHotelsRequest) (*GetHotelsResponse, error)
func (*GRPCServer) UpdateHotel ¶
func (h *GRPCServer) UpdateHotel(ctx context.Context, req *UpdateHotelRequest) (*UpdateHotelResponse, error)
func (*GRPCServer) UploadImage ¶
func (h *GRPCServer) UploadImage(ctx context.Context, req *UploadImageRequest) (*UploadImageResponse, error)
type GetByIDRequest ¶
type GetByIDRequest struct { HotelID string `protobuf:"bytes,1,opt,name=HotelID,proto3" json:"HotelID,omitempty"` // contains filtered or unexported fields }
func (*GetByIDRequest) Descriptor
deprecated
func (*GetByIDRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetByIDRequest.ProtoReflect.Descriptor instead.
func (*GetByIDRequest) GetHotelID ¶
func (x *GetByIDRequest) GetHotelID() string
func (*GetByIDRequest) ProtoMessage ¶
func (*GetByIDRequest) ProtoMessage()
func (*GetByIDRequest) ProtoReflect ¶
func (x *GetByIDRequest) ProtoReflect() protoreflect.Message
func (*GetByIDRequest) Reset ¶
func (x *GetByIDRequest) Reset()
func (*GetByIDRequest) String ¶
func (x *GetByIDRequest) String() string
type GetByIDResponse ¶
type GetByIDResponse struct { Hotel *Hotel `protobuf:"bytes,1,opt,name=Hotel,proto3" json:"Hotel,omitempty"` // contains filtered or unexported fields }
func (*GetByIDResponse) Descriptor
deprecated
func (*GetByIDResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetByIDResponse.ProtoReflect.Descriptor instead.
func (*GetByIDResponse) GetHotel ¶
func (x *GetByIDResponse) GetHotel() *Hotel
func (*GetByIDResponse) ProtoMessage ¶
func (*GetByIDResponse) ProtoMessage()
func (*GetByIDResponse) ProtoReflect ¶
func (x *GetByIDResponse) ProtoReflect() protoreflect.Message
func (*GetByIDResponse) Reset ¶
func (x *GetByIDResponse) Reset()
func (*GetByIDResponse) String ¶
func (x *GetByIDResponse) String() string
type GetHotelsRequest ¶
type GetHotelsRequest struct { Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` // contains filtered or unexported fields }
func (*GetHotelsRequest) Descriptor
deprecated
func (*GetHotelsRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetHotelsRequest.ProtoReflect.Descriptor instead.
func (*GetHotelsRequest) GetPage ¶
func (x *GetHotelsRequest) GetPage() int64
func (*GetHotelsRequest) GetSize ¶
func (x *GetHotelsRequest) GetSize() int64
func (*GetHotelsRequest) ProtoMessage ¶
func (*GetHotelsRequest) ProtoMessage()
func (*GetHotelsRequest) ProtoReflect ¶
func (x *GetHotelsRequest) ProtoReflect() protoreflect.Message
func (*GetHotelsRequest) Reset ¶
func (x *GetHotelsRequest) Reset()
func (*GetHotelsRequest) String ¶
func (x *GetHotelsRequest) String() string
type GetHotelsResponse ¶
type GetHotelsResponse struct { TotalCount int64 `protobuf:"varint,1,opt,name=TotalCount,proto3" json:"TotalCount,omitempty"` TotalPages int64 `protobuf:"varint,2,opt,name=TotalPages,proto3" json:"TotalPages,omitempty"` Page int64 `protobuf:"varint,3,opt,name=Page,proto3" json:"Page,omitempty"` Size int64 `protobuf:"varint,4,opt,name=Size,proto3" json:"Size,omitempty"` HasMore bool `protobuf:"varint,5,opt,name=HasMore,proto3" json:"HasMore,omitempty"` Hotels []*Hotel `protobuf:"bytes,6,rep,name=Hotels,proto3" json:"Hotels,omitempty"` // contains filtered or unexported fields }
func (*GetHotelsResponse) Descriptor
deprecated
func (*GetHotelsResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetHotelsResponse.ProtoReflect.Descriptor instead.
func (*GetHotelsResponse) GetHasMore ¶
func (x *GetHotelsResponse) GetHasMore() bool
func (*GetHotelsResponse) GetHotels ¶
func (x *GetHotelsResponse) GetHotels() []*Hotel
func (*GetHotelsResponse) GetPage ¶
func (x *GetHotelsResponse) GetPage() int64
func (*GetHotelsResponse) GetSize ¶
func (x *GetHotelsResponse) GetSize() int64
func (*GetHotelsResponse) GetTotalCount ¶
func (x *GetHotelsResponse) GetTotalCount() int64
func (*GetHotelsResponse) GetTotalPages ¶
func (x *GetHotelsResponse) GetTotalPages() int64
func (*GetHotelsResponse) ProtoMessage ¶
func (*GetHotelsResponse) ProtoMessage()
func (*GetHotelsResponse) ProtoReflect ¶
func (x *GetHotelsResponse) ProtoReflect() protoreflect.Message
func (*GetHotelsResponse) Reset ¶
func (x *GetHotelsResponse) Reset()
func (*GetHotelsResponse) String ¶
func (x *GetHotelsResponse) String() string
type Hotel ¶
type Hotel struct { CreatedAt *timestamp.Timestamp `protobuf:"bytes,14,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` UpdatedAt *timestamp.Timestamp `protobuf:"bytes,15,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"` HotelID string `protobuf:"bytes,1,opt,name=HotelID,proto3" json:"HotelID,omitempty"` Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` Email string `protobuf:"bytes,3,opt,name=Email,proto3" json:"Email,omitempty"` Country string `protobuf:"bytes,4,opt,name=Country,proto3" json:"Country,omitempty"` City string `protobuf:"bytes,5,opt,name=City,proto3" json:"City,omitempty"` Description string `protobuf:"bytes,6,opt,name=Description,proto3" json:"Description,omitempty"` Location string `protobuf:"bytes,7,opt,name=Location,proto3" json:"Location,omitempty"` Image string `protobuf:"bytes,9,opt,name=Image,proto3" json:"Image,omitempty"` Photos []string `protobuf:"bytes,10,rep,name=Photos,proto3" json:"Photos,omitempty"` CommentsCount int64 `protobuf:"varint,11,opt,name=CommentsCount,proto3" json:"CommentsCount,omitempty"` Rating float64 `protobuf:"fixed64,8,opt,name=Rating,proto3" json:"Rating,omitempty"` Latitude float64 `protobuf:"fixed64,12,opt,name=Latitude,proto3" json:"Latitude,omitempty"` Longitude float64 `protobuf:"fixed64,13,opt,name=Longitude,proto3" json:"Longitude,omitempty"` // contains filtered or unexported fields }
func (*Hotel) Descriptor
deprecated
func (*Hotel) GetCommentsCount ¶
func (*Hotel) GetCountry ¶
func (*Hotel) GetCreatedAt ¶
func (*Hotel) GetDescription ¶
func (*Hotel) GetHotelID ¶
func (*Hotel) GetLatitude ¶
func (*Hotel) GetLocation ¶
func (*Hotel) GetLongitude ¶
func (*Hotel) GetUpdatedAt ¶
func (*Hotel) ProtoMessage ¶
func (*Hotel) ProtoMessage()
func (*Hotel) ProtoReflect ¶
func (x *Hotel) ProtoReflect() protoreflect.Message
type HotelDO ¶
type HotelDO struct { Image *string `json:"image,omitempty"` UpdatedAt *time.Time `json:"updated_at"` CreatedAt *time.Time `json:"created_at"` Longitude *float64 `json:"longitude,omitempty"` Latitude *float64 `json:"latitude,omitempty"` Location string `json:"location" validate:"required,min=10,max=250"` Description string `json:"description,omitempty" validate:"required,min=10,max=250"` City string `json:"city,omitempty" validate:"required,min=3,max=25"` Country string `json:"country,omitempty" validate:"required,min=3,max=25"` Email string `json:"email,omitempty" validate:"required,email"` Name string `json:"name" validate:"required,min=3,max=25"` Photos []string `json:"photos,omitempty"` Rating float64 `json:"rating" validate:"required,min=0,max=10"` CommentsCount int `json:"comments_count,omitempty"` HotelID uuid.UUID `json:"hotel_id"` }
HotelDO model
func (*HotelDO) GetLatitude ¶
func (*HotelDO) GetLongitude ¶
type HotelsServiceClient ¶
type HotelsServiceClient interface { CreateHotel(ctx context.Context, in *CreateHotelRequest, opts ...grpc.CallOption) (*CreateHotelResponse, error) UpdateHotel(ctx context.Context, in *UpdateHotelRequest, opts ...grpc.CallOption) (*UpdateHotelResponse, error) GetHotelByID(ctx context.Context, in *GetByIDRequest, opts ...grpc.CallOption) (*GetByIDResponse, error) GetHotels(ctx context.Context, in *GetHotelsRequest, opts ...grpc.CallOption) (*GetHotelsResponse, error) UploadImage(ctx context.Context, in *UploadImageRequest, opts ...grpc.CallOption) (*UploadImageResponse, error) }
HotelsServiceClient is the client API for HotelsService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewHotelsServiceClient ¶
func NewHotelsServiceClient(cc grpc.ClientConnInterface) HotelsServiceClient
type HotelsServiceServer ¶
type HotelsServiceServer interface { CreateHotel(context.Context, *CreateHotelRequest) (*CreateHotelResponse, error) UpdateHotel(context.Context, *UpdateHotelRequest) (*UpdateHotelResponse, error) GetHotelByID(context.Context, *GetByIDRequest) (*GetByIDResponse, error) GetHotels(context.Context, *GetHotelsRequest) (*GetHotelsResponse, error) UploadImage(context.Context, *UploadImageRequest) (*UploadImageResponse, error) }
HotelsServiceServer is the server API for HotelsService service.
type List ¶
type List struct { Hotels []*HotelDO `json:"comments"` TotalCount int `json:"totalCount"` TotalPages int `json:"totalPages"` Page int `json:"page"` Size int `json:"size"` HasMore bool `json:"hasMore"` }
All Hotels response with pagination
type PublisherImpl ¶
type PublisherImpl struct {
// contains filtered or unexported fields
}
func NewHotelsPublisher ¶
func (*PublisherImpl) CreateExchangeAndQueue ¶
func (p *PublisherImpl) CreateExchangeAndQueue(exchange, queueName, bindingKey string) (*amqp.Channel, error)
type Repository ¶
type Repository interface { CreateHotel(ctx context.Context, hotel *HotelDO) (*HotelDO, error) UpdateHotel(ctx context.Context, hotel *HotelDO) (*HotelDO, error) UpdateHotelImage(ctx context.Context, hotelID uuid.UUID, imageURL string) error GetHotelByID(ctx context.Context, hotelID uuid.UUID) (*HotelDO, error) GetHotels(ctx context.Context, query *pagination.Pagination) (*List, error) }
type RepositoryImpl ¶
type RepositoryImpl struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(db *pgxpool.Pool) RepositoryImpl
func (*RepositoryImpl) CreateHotel ¶
func (*RepositoryImpl) GetHotelByID ¶
func (*RepositoryImpl) GetHotels ¶
func (h *RepositoryImpl) GetHotels(ctx context.Context, query *pagination.Pagination) (*List, error)
func (*RepositoryImpl) UpdateHotel ¶
func (*RepositoryImpl) UpdateHotelImage ¶
type Service ¶
type Service interface { CreateHotel(ctx context.Context, hotel *HotelDO) (*HotelDO, error) UpdateHotel(ctx context.Context, hotel *HotelDO) (*HotelDO, error) GetHotelByID(ctx context.Context, hotelID uuid.UUID) (*HotelDO, error) GetHotels(ctx context.Context, query *pagination.Pagination) (*List, error) UploadImage(ctx context.Context, msg *UploadHotelImageMsg) error UpdateHotelImage(ctx context.Context, delivery amqp.Delivery) error }
type ServiceImpl ¶
type ServiceImpl struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repository Repository, logger logger.Logger, publisher Publisher) ServiceImpl
func (*ServiceImpl) CreateHotel ¶
func (*ServiceImpl) GetHotelByID ¶
func (*ServiceImpl) GetHotels ¶
func (h *ServiceImpl) GetHotels(ctx context.Context, query *pagination.Pagination) (*List, error)
func (*ServiceImpl) UpdateHotel ¶
func (*ServiceImpl) UpdateHotelImage ¶
func (*ServiceImpl) UploadImage ¶
func (h *ServiceImpl) UploadImage(ctx context.Context, msg *UploadHotelImageMsg) error
type UnimplementedHotelsServiceServer ¶
type UnimplementedHotelsServiceServer struct { }
UnimplementedHotelsServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedHotelsServiceServer) CreateHotel ¶
func (*UnimplementedHotelsServiceServer) CreateHotel(context.Context, *CreateHotelRequest) (*CreateHotelResponse, error)
func (*UnimplementedHotelsServiceServer) GetHotelByID ¶
func (*UnimplementedHotelsServiceServer) GetHotelByID(context.Context, *GetByIDRequest) (*GetByIDResponse, error)
func (*UnimplementedHotelsServiceServer) GetHotels ¶
func (*UnimplementedHotelsServiceServer) GetHotels(context.Context, *GetHotelsRequest) (*GetHotelsResponse, error)
func (*UnimplementedHotelsServiceServer) UpdateHotel ¶
func (*UnimplementedHotelsServiceServer) UpdateHotel(context.Context, *UpdateHotelRequest) (*UpdateHotelResponse, error)
func (*UnimplementedHotelsServiceServer) UploadImage ¶
func (*UnimplementedHotelsServiceServer) UploadImage(context.Context, *UploadImageRequest) (*UploadImageResponse, error)
type UpdateHotelImageMsg ¶
type UpdateHotelRequest ¶
type UpdateHotelRequest struct { HotelID string `protobuf:"bytes,1,opt,name=HotelID,proto3" json:"HotelID,omitempty"` Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` Email string `protobuf:"bytes,3,opt,name=Email,proto3" json:"Email,omitempty"` Country string `protobuf:"bytes,4,opt,name=Country,proto3" json:"Country,omitempty"` City string `protobuf:"bytes,5,opt,name=City,proto3" json:"City,omitempty"` Description string `protobuf:"bytes,6,opt,name=Description,proto3" json:"Description,omitempty"` Location string `protobuf:"bytes,7,opt,name=Location,proto3" json:"Location,omitempty"` Image string `protobuf:"bytes,9,opt,name=Image,proto3" json:"Image,omitempty"` Photos []string `protobuf:"bytes,10,rep,name=Photos,proto3" json:"Photos,omitempty"` CommentsCount int64 `protobuf:"varint,11,opt,name=CommentsCount,proto3" json:"CommentsCount,omitempty"` Rating float64 `protobuf:"fixed64,8,opt,name=Rating,proto3" json:"Rating,omitempty"` Latitude float64 `protobuf:"fixed64,12,opt,name=Latitude,proto3" json:"Latitude,omitempty"` Longitude float64 `protobuf:"fixed64,13,opt,name=Longitude,proto3" json:"Longitude,omitempty"` // contains filtered or unexported fields }
func (*UpdateHotelRequest) Descriptor
deprecated
func (*UpdateHotelRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdateHotelRequest.ProtoReflect.Descriptor instead.
func (*UpdateHotelRequest) GetCity ¶
func (x *UpdateHotelRequest) GetCity() string
func (*UpdateHotelRequest) GetCommentsCount ¶
func (x *UpdateHotelRequest) GetCommentsCount() int64
func (*UpdateHotelRequest) GetCountry ¶
func (x *UpdateHotelRequest) GetCountry() string
func (*UpdateHotelRequest) GetDescription ¶
func (x *UpdateHotelRequest) GetDescription() string
func (*UpdateHotelRequest) GetEmail ¶
func (x *UpdateHotelRequest) GetEmail() string
func (*UpdateHotelRequest) GetHotelID ¶
func (x *UpdateHotelRequest) GetHotelID() string
func (*UpdateHotelRequest) GetImage ¶
func (x *UpdateHotelRequest) GetImage() string
func (*UpdateHotelRequest) GetLatitude ¶
func (x *UpdateHotelRequest) GetLatitude() float64
func (*UpdateHotelRequest) GetLocation ¶
func (x *UpdateHotelRequest) GetLocation() string
func (*UpdateHotelRequest) GetLongitude ¶
func (x *UpdateHotelRequest) GetLongitude() float64
func (*UpdateHotelRequest) GetName ¶
func (x *UpdateHotelRequest) GetName() string
func (*UpdateHotelRequest) GetPhotos ¶
func (x *UpdateHotelRequest) GetPhotos() []string
func (*UpdateHotelRequest) GetRating ¶
func (x *UpdateHotelRequest) GetRating() float64
func (*UpdateHotelRequest) ProtoMessage ¶
func (*UpdateHotelRequest) ProtoMessage()
func (*UpdateHotelRequest) ProtoReflect ¶
func (x *UpdateHotelRequest) ProtoReflect() protoreflect.Message
func (*UpdateHotelRequest) Reset ¶
func (x *UpdateHotelRequest) Reset()
func (*UpdateHotelRequest) String ¶
func (x *UpdateHotelRequest) String() string
type UpdateHotelResponse ¶
type UpdateHotelResponse struct { Hotel *Hotel `protobuf:"bytes,1,opt,name=Hotel,proto3" json:"Hotel,omitempty"` // contains filtered or unexported fields }
func (*UpdateHotelResponse) Descriptor
deprecated
func (*UpdateHotelResponse) Descriptor() ([]byte, []int)
Deprecated: Use UpdateHotelResponse.ProtoReflect.Descriptor instead.
func (*UpdateHotelResponse) GetHotel ¶
func (x *UpdateHotelResponse) GetHotel() *Hotel
func (*UpdateHotelResponse) ProtoMessage ¶
func (*UpdateHotelResponse) ProtoMessage()
func (*UpdateHotelResponse) ProtoReflect ¶
func (x *UpdateHotelResponse) ProtoReflect() protoreflect.Message
func (*UpdateHotelResponse) Reset ¶
func (x *UpdateHotelResponse) Reset()
func (*UpdateHotelResponse) String ¶
func (x *UpdateHotelResponse) String() string
type UploadHotelImageMsg ¶
type UploadHotelImageMsg struct { ContentType string `json:"content_type"` Data []byte `json:"date"` HotelID uuid.UUID `json:"hotel_id"` }
UpdateHotelImageMsg
type UploadImageRequest ¶
type UploadImageRequest struct { HotelID string `protobuf:"bytes,1,opt,name=HotelID,proto3" json:"HotelID,omitempty"` ContentType string `protobuf:"bytes,3,opt,name=ContentType,proto3" json:"ContentType,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"` // contains filtered or unexported fields }
func (*UploadImageRequest) Descriptor
deprecated
func (*UploadImageRequest) Descriptor() ([]byte, []int)
Deprecated: Use UploadImageRequest.ProtoReflect.Descriptor instead.
func (*UploadImageRequest) GetContentType ¶
func (x *UploadImageRequest) GetContentType() string
func (*UploadImageRequest) GetData ¶
func (x *UploadImageRequest) GetData() []byte
func (*UploadImageRequest) GetHotelID ¶
func (x *UploadImageRequest) GetHotelID() string
func (*UploadImageRequest) ProtoMessage ¶
func (*UploadImageRequest) ProtoMessage()
func (*UploadImageRequest) ProtoReflect ¶
func (x *UploadImageRequest) ProtoReflect() protoreflect.Message
func (*UploadImageRequest) Reset ¶
func (x *UploadImageRequest) Reset()
func (*UploadImageRequest) String ¶
func (x *UploadImageRequest) String() string
type UploadImageResponse ¶
type UploadImageResponse struct { HotelID string `protobuf:"bytes,1,opt,name=HotelID,proto3" json:"HotelID,omitempty"` // contains filtered or unexported fields }
func (*UploadImageResponse) Descriptor
deprecated
func (*UploadImageResponse) Descriptor() ([]byte, []int)
Deprecated: Use UploadImageResponse.ProtoReflect.Descriptor instead.
func (*UploadImageResponse) GetHotelID ¶
func (x *UploadImageResponse) GetHotelID() string
func (*UploadImageResponse) ProtoMessage ¶
func (*UploadImageResponse) ProtoMessage()
func (*UploadImageResponse) ProtoReflect ¶
func (x *UploadImageResponse) ProtoReflect() protoreflect.Message
func (*UploadImageResponse) Reset ¶
func (x *UploadImageResponse) Reset()
func (*UploadImageResponse) String ¶
func (x *UploadImageResponse) String() string