Documentation ¶
Index ¶
- func AddHookHandler(app *App) func(c echo.Context) error
- func FailWith(status int, message string, c echo.Context) error
- func GetRequestBody(c echo.Context) (string, error)
- func GetRequestJSON(payloadStruct interface{}, c echo.Context) error
- func GetTX(c echo.Context) newrelic.Transaction
- func HealthCheckHandler(app *App) func(c echo.Context) error
- func StatusHandler(app *App) func(c echo.Context) error
- func WithSegment(name string, c echo.Context, f func() error) error
- type App
- type LoggerMiddleware
- type NewRelicMiddleware
- type Options
- type RecoveryMiddleware
- type SentryMiddleware
- type VersionMiddleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHookHandler ¶
AddHookHandler sends new hooks
func GetRequestBody ¶
GetRequestBody from echo context
func GetRequestJSON ¶
GetRequestJSON as the specified interface from echo context
func GetTX ¶ added in v1.0.4
func GetTX(c echo.Context) newrelic.Transaction
GetTX returns new relic transaction
func HealthCheckHandler ¶
HealthCheckHandler is the handler responsible for validating that the app is still up
func StatusHandler ¶
StatusHandler is the handler responsible for validating that the app is still up
Types ¶
type App ¶
type App struct { Fast bool Config *viper.Viper Logger zap.Logger ServerOptions *Options Engine engine.Server WebApp *echo.Echo Client *redis.Client Queue string Errors metrics.EWMA NewRelic newrelic.Application }
App is responsible for Santiago's API
func (*App) GetMessageCount ¶
GetMessageCount returns the message count for the queue
func (*App) PublishHook ¶
PublishHook sends a hook to the queue
type LoggerMiddleware ¶
LoggerMiddleware is responsible for logging to Zap all requests
func NewLoggerMiddleware ¶
func NewLoggerMiddleware(theLogger zap.Logger) *LoggerMiddleware
NewLoggerMiddleware returns the logger middleware
func (*LoggerMiddleware) Serve ¶
func (l *LoggerMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve serves the middleware
type NewRelicMiddleware ¶ added in v1.0.4
NewRelicMiddleware is responsible for logging to Zap all requests
func NewNewRelicMiddleware ¶ added in v1.0.4
func NewNewRelicMiddleware(app *App, theLogger zap.Logger) *NewRelicMiddleware
NewNewRelicMiddleware returns the logger middleware
func (*NewRelicMiddleware) Serve ¶ added in v1.0.4
func (nr *NewRelicMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve serves the middleware
type Options ¶
Options specify configuration to start api with
func DefaultOptions ¶
func DefaultOptions() *Options
DefaultOptions returns local development options for api
type RecoveryMiddleware ¶
RecoveryMiddleware recovers from errors
func NewRecoveryMiddleware ¶
func NewRecoveryMiddleware(onError func(error, []byte)) *RecoveryMiddleware
NewRecoveryMiddleware returns a configured middleware
func (*RecoveryMiddleware) Serve ¶
func (r *RecoveryMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve executes on error handler when errors happen
type SentryMiddleware ¶
type SentryMiddleware struct {
App *App
}
SentryMiddleware is responsible for sending all exceptions to sentry
func NewSentryMiddleware ¶
func NewSentryMiddleware(app *App) *SentryMiddleware
NewSentryMiddleware returns a new sentry middleware
func (*SentryMiddleware) Serve ¶
func (s *SentryMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve serves the middleware
type VersionMiddleware ¶
type VersionMiddleware struct {
Version string
}
VersionMiddleware inserts the current version in all requests
func NewVersionMiddleware ¶
func NewVersionMiddleware() *VersionMiddleware
NewVersionMiddleware with API version
func (*VersionMiddleware) Serve ¶
func (v *VersionMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve serves the middleware