Documentation ¶
Index ¶
- func EnvOrDefaultString(envVar string, defaultValue string) string
- func ErrorHandler(err *ErrorWithStatusCode, res http.ResponseWriter)
- func GenerateToken(tp *TokenPayload) (string, error)
- func JSONResponseHandler(res http.ResponseWriter, statusCode int, payload interface{})
- type ContextKey
- type ErrorResponse
- type ErrorWithStatusCode
- type JWTClaims
- type TokenPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnvOrDefaultString ¶
EnvOrDefaultString ...
func ErrorHandler ¶
func ErrorHandler(err *ErrorWithStatusCode, res http.ResponseWriter)
ErrorHandler handles https error responses
func JSONResponseHandler ¶
func JSONResponseHandler(res http.ResponseWriter, statusCode int, payload interface{})
JSONResponseHandler handles http response in json
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { Message string `json:"message"` Errors interface{} `json:"errors,omitempty"` }
ErrorResponse ...
type ErrorWithStatusCode ¶
ErrorWithStatusCode : This is error model.
type JWTClaims ¶
type JWTClaims struct { ID string `json:"id" bson:"id"` Email string `json:"email" bson:"email"` jwt.StandardClaims }
JWTClaims ...
type TokenPayload ¶
type TokenPayload struct { ID string `json:"id" bson:"id"` Email string `json:"email" bson:"email"` }
TokenPayload ...
Click to show internal directories.
Click to hide internal directories.