Documentation
¶
Index ¶
- func IsValidDateTime(formatStr string) func(fl validator.FieldLevel) bool
- func IsValidDateTimeFormat(v interface{}) error
- func NewCORSMiddleware(cfg *Config) echo.MiddlewareFunc
- func NewCSRFMiddleware(cfg *Config) echo.MiddlewareFunc
- func NewHTTPErrorHandler(cfg *Config) func(err error, c echo.Context)
- func NewJWTMiddleware(cfg *Config) echo.MiddlewareFunc
- func NewJWTRefreshMiddleware(cfg *Config) echo.MiddlewareFunc
- func NewRequestValidator(cfg *Config) *requestValidator
- func RequestValidatorStrictHandlerFunc(f oapi.StrictHandlerFunc, operationID string) oapi.StrictHandlerFunc
- type APIResponse
- type Config
- type CustomCtxKey
- type EnvironmentType
- type Handler
- type IAPIHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidDateTime ¶
func IsValidDateTime(formatStr string) func(fl validator.FieldLevel) bool
Custom validator for go-playground/validator Checks if the field is a valid string time can parse
func IsValidDateTimeFormat ¶
func IsValidDateTimeFormat(v interface{}) error
Custom rule for ozzo-validation Checks if the value is a valid DateTime format which time can parse. This rule does not check more than precision in seconds.
func NewCORSMiddleware ¶
func NewCORSMiddleware(cfg *Config) echo.MiddlewareFunc
func NewCSRFMiddleware ¶
func NewCSRFMiddleware(cfg *Config) echo.MiddlewareFunc
func NewJWTMiddleware ¶
func NewJWTMiddleware(cfg *Config) echo.MiddlewareFunc
func NewJWTRefreshMiddleware ¶
func NewJWTRefreshMiddleware(cfg *Config) echo.MiddlewareFunc
func NewRequestValidator ¶
func NewRequestValidator(cfg *Config) *requestValidator
func RequestValidatorStrictHandlerFunc ¶
func RequestValidatorStrictHandlerFunc(f oapi.StrictHandlerFunc, operationID string) oapi.StrictHandlerFunc
Types ¶
type APIResponse ¶
type Config ¶
type Config struct {
Environment EnvironmentType
APIPort string
AllowedOrigins []string
TLSCertificate string
TLSKey string
// DateTime format used for all request/responses
APIDateTimeFormat string
AuthJWTCookieName string
AuthJWTSigningMethod *jwt.SigningMethodHMAC
AuthJWTSecret string
AuthJWTExpireSeconds int
RefreshJWTCookieName string
RefreshJWTSigningMethod *jwt.SigningMethodHMAC
RefreshJWTSecret string
RefreshJWTExpireSeconds int
DBHost string
DBPort string
DBDatabase string
DBUser string
DBPassword string
}
type EnvironmentType ¶
type EnvironmentType string
const ( EnvironmentLocal EnvironmentType = "local" EnvironmentProduction EnvironmentType = "production" )
type Handler ¶
type Handler struct {
Config *Config
}
func NewHandler ¶
type IAPIHandler ¶
type IAPIHandler interface {
GetJWTTokenClaims(c echo.Context) *auth.JWTClaims
Validate(c echo.Context, req interface{}) error
CreateResponse(err error, data interface{}) *APIResponse
CreateErrorResponse(err error) *APIResponse
}
Default interface for API Handlers I'm not entirely sure if we need this?
Source Files
¶
Click to show internal directories.
Click to hide internal directories.