Documentation
¶
Index ¶
- func CheckImageContentType(image *multipart.FileHeader) error
- func CheckImageFileContentType(fileContent []byte) (string, error)
- func ErrResponseWithLog(ctx echo.Context, logger logger.Logger, err error) error
- func ErrorsWithStack(err error) string
- func ErrorsWithoutStack(err error, format bool) string
- func GetConfigPath(configPath string) string
- func GetCtxWithReqID(c echo.Context) (context.Context, context.CancelFunc)
- func GetHasMore(currentPage int, totalCount int, pageSize int) bool
- func GetIPAddress(c echo.Context) string
- func GetImageContentType(image []byte) (string, bool)
- func GetImageExtension(image *multipart.FileHeader) (string, error)
- func GetRequestCtx(c echo.Context) context.Context
- func GetRequestID(c echo.Context) string
- func GetTotalPages(totalCount int, pageSize int) int
- func GetUniqFileName(userID string, fileExtension string) string
- func IsAllowedImageContentType(image []byte) bool
- func IsAllowedImageHeader(image *multipart.FileHeader) bool
- func LogResponseError(ctx echo.Context, logger logger.Logger, err error)
- func ReadImage(ctx echo.Context, field string) (*multipart.FileHeader, error)
- func ReadRequest(ctx echo.Context, request interface{}) error
- func ValidateStruct(ctx context.Context, s interface{}) error
- type Claims
- type PaginationQuery
- func (q *PaginationQuery) GetLimit() int
- func (q *PaginationQuery) GetOffset() int
- func (q *PaginationQuery) GetOrderBy() string
- func (q *PaginationQuery) GetPage() int
- func (q *PaginationQuery) GetQueryString() string
- func (q *PaginationQuery) GetSize() int
- func (q *PaginationQuery) SetOrderBy(orderByQuery string)
- func (q *PaginationQuery) SetPage(pageQuery string) error
- func (q *PaginationQuery) SetSize(sizeQuery string) error
- type ReqIDCtxKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckImageContentType ¶
func CheckImageContentType(image *multipart.FileHeader) error
func CheckImageFileContentType ¶
Check that the image contentType is in the allowed list
func ErrResponseWithLog ¶
Error response with logging error for echo context
func ErrorsWithStack ¶
ErrorsWithStack returns a string contains error messages in the stack with its stack trace levels for given error
func ErrorsWithoutStack ¶
ErrorsWithoutStack just returns error messages without its callstack
func GetConfigPath ¶
Get config path for local or docker
func GetCtxWithReqID ¶
Get ctx with timeout and request id from echo context
func GetImageContentType ¶
func GetImageExtension ¶
func GetImageExtension(image *multipart.FileHeader) (string, error)
func GetUniqFileName ¶
func IsAllowedImageHeader ¶
func IsAllowedImageHeader(image *multipart.FileHeader) bool
func LogResponseError ¶
Error response with logging error for echo context
func ReadRequest ¶
Read request body and validate
func ValidateStruct ¶
Validate struct fields
Types ¶
type Claims ¶
type Claims struct {
Email string `json:"email"`
ID string `json:"id"`
jwt.StandardClaims
}
JWT Claims struct
type PaginationQuery ¶
type PaginationQuery struct {
Size int `json:"size,omitempty"`
Page int `json:"page,omitempty"`
OrderBy string `json:"orderBy,omitempty"`
}
Pagination query params
func GetPaginationFromCtx ¶
func GetPaginationFromCtx(c echo.Context) (*PaginationQuery, error)
Get pagination query struct from
func (*PaginationQuery) GetQueryString ¶
func (q *PaginationQuery) GetQueryString() string
func (*PaginationQuery) SetOrderBy ¶
func (q *PaginationQuery) SetOrderBy(orderByQuery string)
Set order by
func (*PaginationQuery) SetPage ¶
func (q *PaginationQuery) SetPage(pageQuery string) error
Set page number
func (*PaginationQuery) SetSize ¶
func (q *PaginationQuery) SetSize(sizeQuery string) error
Set page size
type ReqIDCtxKey ¶
type ReqIDCtxKey struct{}
ReqIDCtxKey is a key used for the Request ID in context