Documentation ¶
Index ¶
Constants ¶
View Source
const ( MaxSizePhotoBytes = 5 * 1024 * 1024 MaxCountPhoto = 4 NameImagesInForm = "images" )
Variables ¶
View Source
var ( ErrToBigFile = myerrors.NewErrorBadContentRequest("Максимальный размер фото %d Мбайт", MaxSizePhotoBytes%10204%1024) //nolint:gomnd ErrToManyCountFiles = myerrors.NewErrorBadContentRequest("Максимальное количество фото = %d", MaxCountPhoto) ErrForbiddenRootPath = myerrors.NewErrorBadContentRequest("Нельзя вызывать корневой путь") ErrWrongNameMultipart = myerrors.NewErrorBadFormatRequest("в multipart/form нет нужного имени: %s", NameImagesInForm) )
View Source
var ErrImgUrlsNil = myerrors.NewErrorInternal("imgURLs == nil")
Functions ¶
This section is empty.
Types ¶
type FileHandlerGrpc ¶
type FileHandlerGrpc struct { fileservice.UnimplementedFileServiceServer // contains filtered or unexported fields }
func NewFileHandlerGrpc ¶
func NewFileHandlerGrpc(fileService IFileServiceGrpc) *FileHandlerGrpc
func (*FileHandlerGrpc) Check ¶
func (f *FileHandlerGrpc) Check(ctx context.Context, imgURLs *fileservice.ImgURLs) (*fileservice.CheckedURLs, error)
type FileHandlerHTTP ¶
type FileHandlerHTTP struct {
// contains filtered or unexported fields
}
func NewFileHandlerHTTP ¶
func NewFileHandlerHTTP(fileService IFileServiceHTTP, logger *mylogger.MyLogger, fileServiceDir string, ) *FileHandlerHTTP
func (*FileHandlerHTTP) DocFileServerHandler ¶
func (f *FileHandlerHTTP) DocFileServerHandler() http.Handler
func (*FileHandlerHTTP) UploadFileHandler ¶
func (f *FileHandlerHTTP) UploadFileHandler(w http.ResponseWriter, r *http.Request)
UploadFileHandler godoc
@Summary upload photo @Description upload photo to file service and return its url @Tags fileService @Accept multipart/form-data @Produce json @Success 200 {object} ResponseURLs @Failure 405 {string} string @Failure 500 {string} string @Failure 222 {object} responses.ErrorResponse "Тут статус http статус 200. Внутри body статус может быть badContent(4400), badFormat(4000)"//nolint:lll @Router /img/upload [post]
type IFileServiceGrpc ¶
type IFileServiceHTTP ¶
type ResponseURLBody ¶
type ResponseURLBody struct {
SlURL []string `json:"urls"` //nolint:tagliatelle
}
type ResponseURLs ¶
type ResponseURLs struct { Status int `json:"status"` Body ResponseURLBody `json:"body"` }
func NewResponseURLs ¶
func NewResponseURLs(slURL []string) *ResponseURLs
func (ResponseURLs) MarshalEasyJSON ¶
func (v ResponseURLs) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResponseURLs) MarshalJSON ¶
func (v ResponseURLs) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ResponseURLs) UnmarshalEasyJSON ¶
func (v *ResponseURLs) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResponseURLs) UnmarshalJSON ¶
func (v *ResponseURLs) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
Source Files ¶
Click to show internal directories.
Click to hide internal directories.