Documentation ¶
Index ¶
- Variables
- func FailWith(status int, message string, c echo.Context) error
- func GetAroundMemberHandler(app *App) func(c echo.Context) error
- func GetIntParam(app *App, c echo.Context, paramName string, defaultValue int) (int, error)
- func GetIntRouteParam(app *App, c echo.Context, paramName string, defaultValue int) (int, error)
- func GetMemberHandler(app *App) func(c echo.Context) error
- func GetMemberRankHandler(app *App) func(c echo.Context) error
- func GetMemberRankInManyLeaderboardsHandler(app *App) func(c echo.Context) error
- func GetMembersHandler(app *App) func(c echo.Context) error
- func GetPageSize(app *App, c echo.Context, defaultPageSize int) (int, error)
- func GetRequestBody(c echo.Context) ([]byte, error)
- func GetRequestJSON(payloadStruct interface{}, c echo.Context) error
- func GetTX(c echo.Context) newrelic.Transaction
- func GetTopMembersHandler(app *App) func(c echo.Context) error
- func GetTopPercentageHandler(app *App) func(c echo.Context) error
- func GetTotalMembersHandler(app *App) func(c echo.Context) error
- func HealthCheckHandler(app *App) func(c echo.Context) error
- func IncrementMemberScoreHandler(app *App) func(c echo.Context) error
- func LoadJSONPayload(payloadStruct interface{}, c echo.Context, l zap.Logger) error
- func RemoveLeaderboardHandler(app *App) func(c echo.Context) error
- func RemoveMemberHandler(app *App) func(c echo.Context) error
- func RemoveMembersHandler(app *App) func(c echo.Context) error
- func StatusHandler(app *App) func(c echo.Context) error
- func SucceedWith(payload map[string]interface{}, c echo.Context) error
- func UpsertMemberLeaderboardsScoreHandler(app *App) func(c echo.Context) error
- func UpsertMemberScoreHandler(app *App) func(c echo.Context) error
- func ValidatePayload(payload Validatable) []string
- func WithSegment(name string, c echo.Context, f func() error) error
- type App
- type EasyJSONMarshaler
- type EasyJSONUnmarshaler
- type JSON
- type LoggerMiddleware
- type NewRelicMiddleware
- type RecoveryMiddleware
- type SentryMiddleware
- type Validatable
- type Validation
- type VersionMiddleware
Constants ¶
This section is empty.
Variables ¶
var VERSION = "5.3.0"
VERSION identifies podium's current version
Functions ¶
func GetAroundMemberHandler ¶
GetAroundMemberHandler retrieves a list of member score and rank centered in the given member
func GetIntParam ¶
GetIntParam gets a query parameter as integer
func GetIntRouteParam ¶
GetIntRouteParam gets a query parameter as integer
func GetMemberHandler ¶
GetMemberHandler is the handler responsible for retrieving a member score and rank
func GetMemberRankHandler ¶
GetMemberRankHandler is the handler responsible for retrieving a member rank
func GetMemberRankInManyLeaderboardsHandler ¶
GetMemberRankInManyLeaderboardsHandler returns the member rank in several leaderboards at once
func GetMembersHandler ¶
GetMembersHandler retrieves several members at once
func GetPageSize ¶
GetPageSize gets the page size from the querystring
func GetRequestBody ¶
GetRequestBody from echo context
func GetRequestJSON ¶
GetRequestJSON as the specified interface from echo context
func GetTopMembersHandler ¶
GetTopMembersHandler retrieves onePage of member score and rank
func GetTopPercentageHandler ¶
GetTopPercentageHandler retrieves top x % members in the leaderboard
func GetTotalMembersHandler ¶
GetTotalMembersHandler is the handler responsible for returning the total number of members in a leaderboard
func HealthCheckHandler ¶
HealthCheckHandler is the handler responsible for validating that the app is still up
func IncrementMemberScoreHandler ¶
IncrementMemberScoreHandler is the handler responsible for incrementing the member score
func LoadJSONPayload ¶
LoadJSONPayload loads the JSON payload to the given struct validating all fields are not null
func RemoveLeaderboardHandler ¶
RemoveLeaderboardHandler is the handler responsible for removing a leaderboard
func RemoveMemberHandler ¶
RemoveMemberHandler removes a member from a leaderboard
func RemoveMembersHandler ¶
RemoveMembersHandler removes several members from a leaderboard
func StatusHandler ¶
StatusHandler is the handler responsible for reporting podium status
func SucceedWith ¶
SucceedWith sends payload to member with status 200
func UpsertMemberLeaderboardsScoreHandler ¶
UpsertMemberLeaderboardsScoreHandler sets the member score for all leaderboards
func UpsertMemberScoreHandler ¶
UpsertMemberScoreHandler is the handler responsible for creating or updating the member score
func ValidatePayload ¶
func ValidatePayload(payload Validatable) []string
ValidatePayload for any validatable payload
Types ¶
type App ¶
type App struct { Debug bool Fast bool Port int Host string ConfigPath string Errors metrics.EWMA App *echo.Echo Engine engine.Server Config *viper.Viper Logger zap.Logger RedisClient *util.RedisClient NewRelic newrelic.Application }
App is a struct that represents a podium Application
func GetApp ¶
func GetApp(host string, port int, configPath string, debug, fast bool, logger zap.Logger) (*App, error)
GetApp returns a new podium Application
func (*App) OnErrorHandler ¶
OnErrorHandler handles panics
type EasyJSONMarshaler ¶
EasyJSONMarshaler describes a struct able to marshal json
type EasyJSONUnmarshaler ¶
EasyJSONUnmarshaler describes a struct able to unmarshal json
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 ¶
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 ¶
func (nr *NewRelicMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve serves the middleware
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 Validatable ¶
type Validatable interface {
Validate() []string
}
Validatable indicates that a struct can be validated
type Validation ¶
type Validation struct {
// contains filtered or unexported fields
}
Validation struct
func (Validation) MarshalEasyJSON ¶
func (v Validation) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (*Validation) UnmarshalEasyJSON ¶
func (v *Validation) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
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