Documentation
¶
Index ¶
- Constants
- func DecodeJSON[T any]() func(next http.Handler) http.Handler
- func FromParamsContext[T any](ctx context.Context) (any, T, bool)
- func FromUserContext(ctx context.Context) (string, bool)
- func LogRequest(next http.Handler) http.Handler
- func MountRoutes(r router.Router, h *Handler, v *validator.Validate)
- func NewParamsContext[T any](ctx context.Context, t T) context.Context
- func NewUserContext(ctx context.Context, userID string) context.Context
- func RequireAuth(signer security.Signer) func(http.Handler) http.Handler
- func StartPProf()
- func ValidateInput[T any](validate *validator.Validate) func(next http.Handler) http.Handler
- type AuthHandler
- func (h *AuthHandler) HandleLogout(w http.ResponseWriter, r *http.Request)
- func (h *AuthHandler) HandleRefreshToken(w http.ResponseWriter, r *http.Request)
- func (h *AuthHandler) HandleUserLogin(w http.ResponseWriter, r *http.Request)
- func (h *AuthHandler) HandleUserRegister(w http.ResponseWriter, r *http.Request)
- func (h *AuthHandler) VerifyEmail(w http.ResponseWriter, r *http.Request)
- type BaseHandler
- type Handler
- type RegisterUserRequest
- type RegisterUserResponse
- type Response
- type SafeResponseWriter
- type UserLoginRequest
- type UserLoginResponse
Constants ¶
View Source
const ( HeaderContentType = "Content-Type" MimeJSON = "application/json" )
Variables ¶
This section is empty.
Functions ¶
func StartPProf ¶
func StartPProf()
Types ¶
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
func NewAuthHandler ¶
func NewAuthHandler(userService service.AuthService, signer security.Signer, cfg *config.Config) *AuthHandler
func (*AuthHandler) HandleLogout ¶
func (h *AuthHandler) HandleLogout(w http.ResponseWriter, r *http.Request)
func (*AuthHandler) HandleRefreshToken ¶
func (h *AuthHandler) HandleRefreshToken(w http.ResponseWriter, r *http.Request)
func (*AuthHandler) HandleUserLogin ¶
func (h *AuthHandler) HandleUserLogin(w http.ResponseWriter, r *http.Request)
func (*AuthHandler) HandleUserRegister ¶
func (h *AuthHandler) HandleUserRegister(w http.ResponseWriter, r *http.Request)
func (*AuthHandler) VerifyEmail ¶
func (h *AuthHandler) VerifyEmail(w http.ResponseWriter, r *http.Request)
type BaseHandler ¶
type BaseHandler struct {
// contains filtered or unexported fields
}
func NewBaseHandler ¶
func NewBaseHandler(svc service.BaseService) *BaseHandler
func (*BaseHandler) HandleHealth ¶
func (h *BaseHandler) HandleHealth(w http.ResponseWriter, r *http.Request)
type Handler ¶
type Handler struct {
Base BaseHandler
Auth AuthHandler
}
type RegisterUserRequest ¶
type RegisterUserRequest struct {
Email string `json:"email,omitempty" validate:"required,email"`
Password string `json:"password,omitempty" validate:"required"`
PasswordConfirm string `json:"password_confirm,omitempty" validate:"required,eqfield=Password"`
}
func (*RegisterUserRequest) LogValue ¶
func (r *RegisterUserRequest) LogValue() slog.Value
type RegisterUserResponse ¶
type SafeResponseWriter ¶
type SafeResponseWriter struct {
http.ResponseWriter
// contains filtered or unexported fields
}
func NewSafeResponseWriter ¶
func NewSafeResponseWriter(ctx context.Context, w http.ResponseWriter) *SafeResponseWriter
func (*SafeResponseWriter) BytesWritten ¶
func (w *SafeResponseWriter) BytesWritten() int
func (*SafeResponseWriter) Status ¶
func (w *SafeResponseWriter) Status() int
func (*SafeResponseWriter) WriteHeader ¶
func (w *SafeResponseWriter) WriteHeader(statusCode int)
type UserLoginRequest ¶
type UserLoginRequest struct {
Email string `json:"email,omitempty" validate:"required,email"`
Password string `json:"password,omitempty" validate:"required"`
}
func (*UserLoginRequest) LogValue ¶
func (r *UserLoginRequest) LogValue() slog.Value
type UserLoginResponse ¶
type UserLoginResponse struct {
AccessToken string `json:"access_token,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.