Documentation ¶
Index ¶
- Constants
- Variables
- func NewS3Session(cfg *config.Config) *s3.S3
- func RegisterImageServiceServer(s *grpc.Server, srv ImageServiceServer)
- type AWSS3Client
- type AWSStorage
- 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 CreateImageMsg
- type GetByIDRequest
- type GetByIDResponse
- type Image
- func (*Image) Descriptor() ([]byte, []int)deprecated
- func (x *Image) GetCreatedAt() *timestamp.Timestamp
- func (x *Image) GetImageID() string
- func (x *Image) GetImageURL() string
- func (x *Image) GetIsUploaded() bool
- func (*Image) ProtoMessage()
- func (x *Image) ProtoReflect() protoreflect.Message
- func (x *Image) Reset()
- func (x *Image) String() string
- type ImageDO
- type ImageServer
- type ImageServiceClient
- type ImageServiceServer
- type ImgResizer
- type Publisher
- type PublisherImpl
- type Repository
- type RepositoryImpl
- type Service
- type ServiceImpl
- func (s *ServiceImpl) Create(ctx context.Context, delivery amqp.Delivery) error
- func (s *ServiceImpl) GetImageByID(ctx context.Context, imageID uuid.UUID) (*ImageDO, error)
- func (s *ServiceImpl) ProcessHotelImage(ctx context.Context, delivery amqp.Delivery) error
- func (s *ServiceImpl) ResizeImage(ctx context.Context, delivery amqp.Delivery) error
- type UnimplementedImageServiceServer
- type UpdateAvatarMsg
- type UpdateHotelImageMsg
- type UploadImageMsg
- type UploadedImageMsg
Constants ¶
View Source
const ( ExchangeName = "images" ResizeQueueName = "resize_queue" ResizeConsumerTag = "resize_consumer" ResizeWorkers = 10 ResizeBindingKey = "resize_image_key" CreateQueueName = "create_queue" CreateConsumerTag = "create_consumer" CreateWorkers = 5 CreateBindingKey = "create_image_key" UploadHotelImageQueue = "upload_hotel_image_queue" UploadHotelImageConsumerTag = "upload_hotel_image_consumer_tag" UploadHotelImageWorkers = 10 UploadHotelImageBindingKey = "upload_hotel_image_binding_key" )
Variables ¶
View Source
var ( ErrInvalidUUID = errors.New("invalid uuid") ErrInvalidDeliveryHeaders = errors.New("invalid uuid") ErrInternalServerError = errors.New("internal server error") ErrInvalidImageFormat = errors.New("invalid image format") )
View Source
var File_app_images_image_proto protoreflect.FileDescriptor
Functions ¶
func RegisterImageServiceServer ¶
func RegisterImageServiceServer(s *grpc.Server, srv ImageServiceServer)
Types ¶
type AWSS3Client ¶
type AWSS3Client struct {
// contains filtered or unexported fields
}
func NewAWSStorage ¶
func NewAWSStorage(cfg *config.Config, s3 *s3.S3) AWSS3Client
func (*AWSS3Client) DeleteObject ¶
func (i *AWSS3Client) DeleteObject(ctx context.Context, key string) error
func (*AWSS3Client) GetObject ¶
func (i *AWSS3Client) GetObject(ctx context.Context, key string) (*s3.GetObjectOutput, error)
type AWSStorage ¶
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 NewImageConsumer ¶
func NewImageConsumer( logger logger.Logger, cfg *config.Config, service Service, incomingMessages prometheus.Counter, successMessages prometheus.Counter, errorMessages prometheus.Counter, ) ConsumerImpl
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)
Consume messages
func (*ConsumerImpl) Dial ¶
func (c *ConsumerImpl) Dial() error
func (*ConsumerImpl) RunConsumers ¶
func (c *ConsumerImpl) RunConsumers(ctx context.Context, cancel context.CancelFunc)
type CreateImageMsg ¶
type CreateImageMsg struct { ImageURL string `json:"image_url"` IsUploaded bool `json:"is_uploaded"` }
Event message for create image
type GetByIDRequest ¶
type GetByIDRequest struct { ImageID string `protobuf:"bytes,1,opt,name=ImageID,proto3" json:"ImageID,omitempty"` // contains filtered or unexported fields }
func (*GetByIDRequest) Descriptor
deprecated
func (*GetByIDRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetByIDRequest.ProtoReflect.Descriptor instead.
func (*GetByIDRequest) GetImageID ¶
func (x *GetByIDRequest) GetImageID() 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 { Image *Image `protobuf:"bytes,1,opt,name=Image,proto3" json:"Image,omitempty"` // contains filtered or unexported fields }
func (*GetByIDResponse) Descriptor
deprecated
func (*GetByIDResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetByIDResponse.ProtoReflect.Descriptor instead.
func (*GetByIDResponse) GetImage ¶
func (x *GetByIDResponse) GetImage() *Image
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 Image ¶
type Image struct { CreatedAt *timestamp.Timestamp `protobuf:"bytes,4,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` ImageID string `protobuf:"bytes,1,opt,name=ImageID,proto3" json:"ImageID,omitempty"` ImageURL string `protobuf:"bytes,2,opt,name=ImageURL,proto3" json:"ImageURL,omitempty"` IsUploaded bool `protobuf:"varint,3,opt,name=IsUploaded,proto3" json:"IsUploaded,omitempty"` // contains filtered or unexported fields }
func (*Image) Descriptor
deprecated
func (*Image) GetCreatedAt ¶
func (*Image) GetImageID ¶
func (*Image) GetImageURL ¶
func (*Image) GetIsUploaded ¶
func (*Image) ProtoMessage ¶
func (*Image) ProtoMessage()
func (*Image) ProtoReflect ¶
func (x *Image) ProtoReflect() protoreflect.Message
type ImageDO ¶
type ImageDO struct { CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` ImageURL string `json:"image_url"` ImageID uuid.UUID `json:"image_id"` IsUploaded bool `json:"is_uploaded"` }
ImageDO model
type ImageServer ¶
type ImageServer struct {
// contains filtered or unexported fields
}
func NewImageServer ¶
func (*ImageServer) GetImageByID ¶
func (i *ImageServer) GetImageByID(ctx context.Context, req *GetByIDRequest) (*GetByIDResponse, error)
type ImageServiceClient ¶
type ImageServiceClient interface {
GetImageByID(ctx context.Context, in *GetByIDRequest, opts ...grpc.CallOption) (*GetByIDResponse, error)
}
ImageServiceClient is the client API for ImageService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewImageServiceClient ¶
func NewImageServiceClient(cc grpc.ClientConnInterface) ImageServiceClient
type ImageServiceServer ¶
type ImageServiceServer interface {
GetImageByID(context.Context, *GetByIDRequest) (*GetByIDResponse, error)
}
ImageServiceServer is the server API for ImageService service.
type ImgResizer ¶
func NewImgResizer ¶
func NewImgResizer(filters ...gift.Filter) *ImgResizer
type PublisherImpl ¶
type PublisherImpl struct {
// contains filtered or unexported fields
}
func NewPublisher ¶
func NewPublisher( cfg *config.Config, logger logger.Logger, incomingMessages prometheus.Counter, successMessages prometheus.Counter, errorMessages prometheus.Counter, ) (PublisherImpl, error)
func (*PublisherImpl) CreateExchangeAndQueue ¶
func (p *PublisherImpl) CreateExchangeAndQueue(exchange, queueName, bindingKey string) (*amqp.Channel, error)
type Repository ¶
type RepositoryImpl ¶
type RepositoryImpl struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(pgxPool *pgxpool.Pool) RepositoryImpl
func (*RepositoryImpl) GetImageByID ¶
type ServiceImpl ¶
type ServiceImpl struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(pgRepo Repository, awsRepo AWSStorage, logger logger.Logger, publisher Publisher) ServiceImpl
func (*ServiceImpl) GetImageByID ¶
func (*ServiceImpl) ProcessHotelImage ¶
func (*ServiceImpl) ResizeImage ¶
type UnimplementedImageServiceServer ¶
type UnimplementedImageServiceServer struct { }
UnimplementedImageServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedImageServiceServer) GetImageByID ¶
func (*UnimplementedImageServiceServer) GetImageByID(context.Context, *GetByIDRequest) (*GetByIDResponse, error)
type UpdateAvatarMsg ¶
type UpdateAvatarMsg struct { ContentType string `json:"content_type"` Body []byte UserID uuid.UUID `json:"user_id"` }
Event message for upload user avatar
type UpdateHotelImageMsg ¶
Click to show internal directories.
Click to hide internal directories.