app

package
v4.2.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2019 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VERSION = "4.2.2"

VERSION is the current api version

Functions

func GetTX

GetTX returns new relic transaction

func GetTopics

func GetTopics(ctx context.Context, username string, _topics []string) ([]string, error)

GetTopics get topics

func HealthCheckHandler

func HealthCheckHandler(app *App) func(c echo.Context) error

HealthCheckHandler is the handler responsible for validating that the app is still up

func HistoriesHandler

func HistoriesHandler(app *App) func(c echo.Context) error

HistoriesHandler is the handler responsible for sending multiples rooms history to the player

func HistoryHandler

func HistoryHandler(app *App) func(c echo.Context) error

HistoryHandler is the handler responsible for sending the rooms history to the player

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError returns true if error is of not found type

func NotFoundHandler

func NotFoundHandler(app *App) func(c echo.Context) error

NotFoundHandler is the handler responsible for responding when no resource was found

func VersionMiddleware

func VersionMiddleware(next echo.HandlerFunc) echo.HandlerFunc

VersionMiddleware automatically adds a version header to response

func WithSegment

func WithSegment(name string, c echo.Context, f func() error) error

WithSegment adds a segment to new relic transaction

Types

type ACL

type ACL struct {
	ID       bson.ObjectId `bson:"_id,omitempty"`
	Username string        `bson:"username"`
	Pubsub   []string      `bson:"pubsub"`
}

ACL is the acl struct

func MongoSearch

func MongoSearch(ctx context.Context, q interface{}) ([]ACL, error)

MongoSearch searchs on mongo

type App

type App struct {
	Debug                bool
	Port                 int
	Host                 string
	API                  *echo.Echo
	Engine               engine.Server
	ConfigPath           string
	Config               *viper.Viper
	NewRelic             newrelic.Application
	NumberOfDaysToSearch int
	DDStatsD             *extnethttpmiddleware.DogStatsD
	Cassandra            cassandra.DataStore
	Defaults             *models.Defaults
	Bucket               *models.Bucket
}

App is the struct that defines the application

func GetApp

func GetApp(host string, port int, debug bool, configPath string) *App

GetApp creates an app given the parameters

func (*App) Configure

func (app *App) Configure()

Configure configures the application

func (*App) OnErrorHandler

func (app *App) OnErrorHandler(err interface{}, stack []byte)

OnErrorHandler handles application panics

func (*App) Start

func (app *App) Start()

Start starts the application

type LoggerMiddleware

type LoggerMiddleware struct {
	Logger zap.Logger
}

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

Serve serves the middleware

type NewRelicMiddleware

type NewRelicMiddleware struct {
	App    *App
	Logger zap.Logger
}

NewRelicMiddleware is responsible for logging to Zap all requests

func NewNewRelicMiddleware

func NewNewRelicMiddleware(app *App, theLogger zap.Logger) *NewRelicMiddleware

NewNewRelicMiddleware returns the logger middleware

func (*NewRelicMiddleware) Serve

Serve serves the middleware

type RecoveryMiddleware

type RecoveryMiddleware struct {
	OnError func(interface{}, []byte)
}

RecoveryMiddleware recovers from errors in Echo

func NewRecoveryMiddleware

func NewRecoveryMiddleware(onError func(interface{}, []byte)) *RecoveryMiddleware

NewRecoveryMiddleware returns a configured middleware

func (RecoveryMiddleware) Serve

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

Serve serves the middleware

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL