Documentation
¶
Index ¶
- func BadRequest(w http.ResponseWriter, message string)
- func Error(t assert.TestingT, err *GoGoError, msgAndArgs ...interface{}) bool
- func GenerateJWT(secret string, id int, email string) (string, error)
- func InternalServerError(w http.ResponseWriter, err error)
- func MethodNotAllowed(w http.ResponseWriter, method string)
- func NoError(t assert.TestingT, err *GoGoError, msgAndArgs ...interface{}) bool
- func NotFound(w http.ResponseWriter, message string)
- func SendErrorResponse(w http.ResponseWriter, msg string, statusCode int)
- func Unauthorized(w http.ResponseWriter)
- func UniqueConstraintError(err error) error
- func WriteJSON(w http.ResponseWriter, status int, data interface{})
- type AuthAction
- type AuthResponse
- type Claims
- type ComparePassword
- type Credential
- type Encryption
- type ErrorResponse
- type ErrorType
- type GetJWT
- type GoGoError
- type HashPassword
- type JWTHandler
- type ManagerRequest
- type ManagerResponse
- type ParseJWT
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
func BadRequest(w http.ResponseWriter, message string)
func InternalServerError ¶
func InternalServerError(w http.ResponseWriter, err error)
func MethodNotAllowed ¶
func MethodNotAllowed(w http.ResponseWriter, method string)
func SendErrorResponse ¶
func SendErrorResponse(w http.ResponseWriter, msg string, statusCode int)
func Unauthorized ¶
func Unauthorized(w http.ResponseWriter)
func UniqueConstraintError ¶
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, status int, data interface{})
WriteJSON writes a JSON response with the given status code and data
Types ¶
type AuthAction ¶
type AuthAction string
const ( Register AuthAction = "create" Login AuthAction = "login" )
type AuthResponse ¶
type Claims ¶
type Claims struct {
ID int `json:"id"`
Email string `json:"email"`
jwt.RegisteredClaims
}
type ComparePassword ¶
type Credential ¶
type Credential struct {
Email string `json:"email"`
Password string `json:"password"`
Action AuthAction `json:"action"`
}
type Encryption ¶
type ErrorResponse ¶
type JWTHandler ¶
type ManagerRequest ¶
type ManagerRequest struct {
ID int
Email *string `json:"email"`
Password *string `json:"password"`
Name *string `json:"name"`
UserImageUri *string `json:"userImageUri"`
CompanyName *string `json:"companyName"`
CompanyImageUri *string `json:"companyImageUri"`
}
func (ManagerRequest) ValidCompanyImageURI ¶
func (m ManagerRequest) ValidCompanyImageURI() bool
func (ManagerRequest) ValidCompanyName ¶
func (m ManagerRequest) ValidCompanyName() bool
func (ManagerRequest) ValidEmail ¶
func (m ManagerRequest) ValidEmail() bool
func (ManagerRequest) ValidImageURI ¶
func (m ManagerRequest) ValidImageURI() bool
func (ManagerRequest) ValidName ¶
func (m ManagerRequest) ValidName() bool
func (ManagerRequest) ValidPassword ¶
func (m ManagerRequest) ValidPassword() bool
type ManagerResponse ¶
Click to show internal directories.
Click to hide internal directories.