Documentation ¶
Index ¶
- func ConfigureJWTCookie(cfg *config.Config, jwtToken string) *http.Cookie
- func ConfigureSessionCookie(cfg *config.Config, session string) *http.Cookie
- func DeleteSessionCookie(c echo.Context, sessionName string)
- func ExtractJWTFromRequest(r *http.Request) (map[string]interface{}, error)
- func ExtratcBearerToken(r *http.Request) string
- func GenerateJWTToken(user *entity.User, config *config.Config) (string, error)
- func GetHasMore(currentPage int, totalCount int, pageSize int) bool
- func GetIP(c echo.Context) string
- func GetRequestCtx(c echo.Context) context.Context
- func GetRequestID(c echo.Context) string
- func GetTotalPages(totalCount int, pageSize int) int
- func GetUserFromCtx(ctx context.Context) (*entity.User, error)
- func ReadRequest(ctx echo.Context, request interface{}) error
- func ValidateIsOwner(ctx context.Context, creatorID string, logger logger.Logger) error
- func ValidateStruct(ctx context.Context, s interface{}) error
- type Claims
- type PaginationQuery
- func (q *PaginationQuery) GetDifference() int
- func (q *PaginationQuery) GetLimit() int
- func (q *PaginationQuery) GetOrderBy() string
- func (q *PaginationQuery) GetPage() int
- func (q *PaginationQuery) GetSize() int
- func (q *PaginationQuery) SetDifference(differenceQuery string) error
- func (q *PaginationQuery) SetOrderBy(orderByQuery string)
- func (q *PaginationQuery) SetPage(pageQuery string) error
- func (q *PaginationQuery) SetSize(sizeQuery string) error
- type ReqIDCtxKey
- type UserCtxKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureJWTCookie ¶
Configure JWT cookie
func ConfigureSessionCookie ¶
Configure Session Cookie
func DeleteSessionCookie ¶
func DeleteSessionCookie(c echo.Context, sessionName string)
Delete session
func ExtractJWTFromRequest ¶
Extract JWT from Request
func ExtratcBearerToken ¶
Extract bearer token from request Authorization header
func GenerateJWTToken ¶
Generate new JWT Token
func GetUserFromCtx ¶
Get User from context
func ReadRequest ¶
func ReadRequest(ctx echo.Context, request interface{}) error
Read request body and validate
func ValidateIsOwner ¶
Validate is user from owner of content
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"` Difference int `json:"difference,omitempty"` OrderBy string `json:"orderBy,omitempty"` }
Pagination with out offset
func GetPaginationFromCtx ¶
func GetPaginationFromCtx(c echo.Context) (*PaginationQuery, error)
Get pagination query struct from
func (*PaginationQuery) GetDifference ¶
func (q *PaginationQuery) GetDifference() int
Get difference
func (*PaginationQuery) SetDifference ¶
func (q *PaginationQuery) SetDifference(differenceQuery string) error
Set difference
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 from context
type UserCtxKey ¶
type UserCtxKey struct{}
UserCtxKey is a key used for the User object in the context
Click to show internal directories.
Click to hide internal directories.