Documentation ¶
Index ¶
- func GetService(serviceName ServiceName, serviceMap *InjectedServicesMap) (interface{}, bool)
- func InitModule(modules []*Module, moduleParams *InitModuleParams, basePath *string)
- func NewRequestValidator() echo.Validator
- func UploadHandler(context AppContext, s3Config S3Uploader.S3) (*S3Uploader.UploadId, error)
- type AppContext
- type ControllerConfig
- type Controllers
- type HTTPError
- type HTTPMethod
- type HTTPMethodConfig
- type HTTPMethodHandler
- type HTTPMethodHandlerConfig
- type Headers
- type InitModuleParams
- type InjectedServicesMap
- type Module
- type QueryParams
- type RequestContext
- type RequestValidator
- type RoutePath
- type ServiceName
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetService ¶
func GetService(serviceName ServiceName, serviceMap *InjectedServicesMap) (interface{}, bool)
GetService It returns the service from the injected service map
func InitModule ¶
func InitModule(modules []*Module, moduleParams *InitModuleParams, basePath *string)
InitModule It initializes the module by registering routes
func NewRequestValidator ¶
func NewRequestValidator() echo.Validator
NewRequestValidator creates a new RequestValidator
func UploadHandler ¶
func UploadHandler(context AppContext, s3Config S3Uploader.S3) (*S3Uploader.UploadId, error)
UploadHandler Default upload handler for thunderbyte Checks for the form field with name="file". Returns an error if it does not find that field
Types ¶
type AppContext ¶
type AppContext struct { RequestContext RequestContext HTTPServerContext echo.Context DBConfig *database.DBConfig Redis *redis.Redis SMTPPool *smtppool.Pool Logger *logf.Logger K *koanf.Koanf Q interface{} }
func (*AppContext) SetCookie ¶
func (ctx *AppContext) SetCookie(cookie *http.Cookie)
type ControllerConfig ¶
type ControllerConfig struct { ModulePath RoutePath Controllers Controllers JWTSecret string // If present then JWT middleware will be added on the module }
type Controllers ¶
type Controllers map[RoutePath]HTTPMethodConfig
type HTTPError ¶
type HTTPMethod ¶
type HTTPMethod int
const ( GET HTTPMethod = iota POST PUT DELETE PATCH OPTIONS HEAD TRACE CONNECT )
type HTTPMethodConfig ¶
type HTTPMethodConfig map[HTTPMethod]HTTPMethodHandlerConfig
type HTTPMethodHandler ¶
type HTTPMethodHandler func(context AppContext, injectedServicesMap *InjectedServicesMap) (interface{}, *HTTPError)
type HTTPMethodHandlerConfig ¶
type HTTPMethodHandlerConfig struct { Handler HTTPMethodHandler JWTSecret string // If present then JWT middleware will be added on the handler }
type InitModuleParams ¶
type InjectedServicesMap ¶
type InjectedServicesMap map[ServiceName]interface{}
type Module ¶
type Module struct { E *echo.Echo L *logf.Logger ControllerConfig *ControllerConfig Providers []interface{} Imports []*Module }
type QueryParams ¶
type RequestContext ¶
type RequestContext struct { Body interface{} QueryParams QueryParams Path string Headers Headers }
type RequestValidator ¶
type RequestValidator struct {
// contains filtered or unexported fields
}
func (*RequestValidator) Validate ¶
func (cv *RequestValidator) Validate(i interface{}) error
type ServiceName ¶
type ServiceName string
Click to show internal directories.
Click to hide internal directories.