api

package
v4.3.12+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 License: MIT Imports: 57 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyForMembershipHandler

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

ApplyForMembershipHandler is the handler responsible for applying for new memberships

func ApproveOrDenyMembershipApplicationHandler

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

ApproveOrDenyMembershipApplicationHandler is the handler responsible for approving or denying a membership invitation

func ApproveOrDenyMembershipInvitationHandler

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

ApproveOrDenyMembershipInvitationHandler is the handler responsible for approving or denying a membership invitation

func CreateClanHandler

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

CreateClanHandler is the handler responsible for creating new clans

func CreateGameHandler

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

CreateGameHandler is the handler responsible for creating new games

func CreateHookHandler

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

CreateHookHandler is the handler responsible for creating new hooks

func CreatePlayerHandler

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

CreatePlayerHandler is the handler responsible for creating new players

func DeleteMembershipHandler

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

DeleteMembershipHandler is the handler responsible for deleting a member

func FailWith

func FailWith(status int, message string, c echo.Context) error

FailWith fails with the specified message

func FailWithError

func FailWithError(err error, c echo.Context) error

FailWithError fails with the specified error

func GetRequestBody added in v0.9.15

func GetRequestBody(c echo.Context) ([]byte, error)

GetRequestBody from echo context

func GetRequestJSON added in v0.9.15

func GetRequestJSON(payloadStruct interface{}, c echo.Context) error

GetRequestJSON as the specified interface from echo context

func GetTX added in v0.10.0

GetTX returns new relic transaction

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 InviteForMembershipHandler

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

InviteForMembershipHandler is the handler responsible for creating new memberships

func LeaveClanHandler

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

LeaveClanHandler is the handler responsible for changing the clan ownership when the owner leaves it

func ListClansHandler

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

ListClansHandler is the handler responsible for returning a list of all clans

func LoadJSONPayload

func LoadJSONPayload(payloadStruct interface{}, c echo.Context, l zap.Logger) error

LoadJSONPayload loads the JSON payload to the given struct validating all fields are not null

func PromoteOrDemoteMembershipHandler

func PromoteOrDemoteMembershipHandler(app *App, action string) func(c echo.Context) error

PromoteOrDemoteMembershipHandler is the handler responsible for promoting or demoting a member

func RemoveHookHandler

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

RemoveHookHandler is the handler responsible for removing existing hooks

func RetrieveClanHandler

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

RetrieveClanHandler is the handler responsible for returning details for a given clan

func RetrieveClanMembersHandler

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

RetrieveClanMembersHandler retrieves only the clan users

func RetrieveClanSummaryHandler

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

RetrieveClanSummaryHandler is the handler responsible for returning details summary for a given clan

func RetrieveClansSummariesHandler

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

RetrieveClansSummariesHandler is the handler responsible for returning details summary for a given list of clans

func RetrievePlayerHandler

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

RetrievePlayerHandler is the handler responsible for returning details for a given player

func SearchClansHandler

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

SearchClansHandler is the handler responsible for searching for clans

func SetRetrieveClanHandlerConfigurationDefaults

func SetRetrieveClanHandlerConfigurationDefaults(config *viper.Viper)

SetRetrieveClanHandlerConfigurationDefaults sets the default configs for RetrieveClanHandler

func StatusHandler

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

StatusHandler is the handler responsible for reporting khan status

func SucceedWith

func SucceedWith(payload map[string]interface{}, c echo.Context) error

SucceedWith sends payload to user with status 200

func TransferOwnershipHandler

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

TransferOwnershipHandler is the handler responsible for transferring the clan ownership to another clan member

func UpdateClanHandler

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

UpdateClanHandler is the handler responsible for updating existing clans

func UpdateGameHandler

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

UpdateGameHandler is the handler responsible for updating existing

func UpdatePlayerHandler

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

UpdatePlayerHandler is the handler responsible for updating existing

func ValidatePayload added in v0.9.15

func ValidatePayload(payload Validatable) []string

ValidatePayload for any validatable payload

func WithSegment added in v0.10.0

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

WithSegment adds a segment to new relic transaction

Types

type App

type App struct {
	ID             string
	Test           bool
	Debug          bool
	Port           int
	Host           string
	ConfigPath     string
	Errors         metrics.EWMA
	App            *eecho.Echo
	Engine         engine.Server
	Config         *viper.Viper
	Dispatcher     *Dispatcher
	ESWorker       *models.ESWorker
	MongoWorker    *models.MongoWorker
	Logger         zap.Logger
	ESClient       *es.Client
	MongoDB        interfaces.MongoDB
	ReadBufferSize int
	Fast           bool
	NewRelic       newrelic.Application
	DDStatsD       *extnethttpmiddleware.DogStatsD
	// contains filtered or unexported fields
}

App is a struct that represents a Khan API Application

func GetApp

func GetApp(host string, port int, configPath string, debug bool, logger zap.Logger, fast, test bool) *App

GetApp returns a new Khan API Application

func (*App) BeginTrans

func (app *App) BeginTrans(ctx context.Context, l zap.Logger) (gorp.Transaction, error)

BeginTrans in the current Db connection

func (*App) Commit

func (app *App) Commit(tx gorp.Transaction, msg string, c echo.Context, l zap.Logger) error

Commit transaction

func (*App) Configure

func (app *App) Configure()

Configure instantiates the required dependencies for Khan Api Application

func (*App) Db

func (app *App) Db(ctx context.Context) gorp.Database

Db returns a gorp database connection using the given context

func (*App) DispatchHooks

func (app *App) DispatchHooks(gameID string, eventType int, payload map[string]interface{}) error

DispatchHooks dispatches web hooks for a specific game and event type

func (*App) GetCtxDB

func (app *App) GetCtxDB(ctx echo.Context) (gorp.Database, error)

GetCtxDB returns the proper database connection depending on the request context

func (*App) GetGame

func (app *App) GetGame(ctx context.Context, gameID string) (*models.Game, error)

GetGame returns a game by Public ID

func (*App) GetHooks

func (app *App) GetHooks(ctx context.Context) map[string]map[int][]*models.Hook

GetHooks returns all available hooks

func (*App) NonblockingStartWorkers

func (app *App) NonblockingStartWorkers()

NonblockingStartWorkers non-blocking

func (*App) Rollback

func (app *App) Rollback(tx gorp.Transaction, msg string, c echo.Context, l zap.Logger, err error) error

Rollback transaction

func (*App) Start

func (app *App) Start()

Start starts listening for web requests at specified host and port

func (*App) StartWorkers

func (app *App) StartWorkers()

StartWorkers "starts" the dispatcher

type ApplyForMembershipPayload added in v0.9.15

type ApplyForMembershipPayload struct {
	Level          string `json:"level"`
	PlayerPublicID string `json:"playerPublicID"`
}

ApplyForMembershipPayload maps the payload required for the Apply for Membership route

func (ApplyForMembershipPayload) MarshalEasyJSON added in v0.9.15

func (v ApplyForMembershipPayload) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*ApplyForMembershipPayload) UnmarshalEasyJSON added in v0.9.15

func (v *ApplyForMembershipPayload) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ApplyForMembershipPayload) Validate added in v0.9.15

func (afmp *ApplyForMembershipPayload) Validate() []string

Validate all the required fields

type ApproveOrDenyMembershipInvitationPayload added in v0.9.15

type ApproveOrDenyMembershipInvitationPayload struct {
	PlayerPublicID string `json:"playerPublicID"`
}

ApproveOrDenyMembershipInvitationPayload maps the payload required for Approving or Denying a membership

func (ApproveOrDenyMembershipInvitationPayload) MarshalEasyJSON added in v0.9.15

MarshalEasyJSON supports easyjson.Marshaler interface

func (*ApproveOrDenyMembershipInvitationPayload) UnmarshalEasyJSON added in v0.9.15

func (v *ApproveOrDenyMembershipInvitationPayload) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ApproveOrDenyMembershipInvitationPayload) Validate added in v0.9.15

Validate all the required fields

type BasePayloadWithRequestorAndPlayerPublicIDs added in v0.9.15

type BasePayloadWithRequestorAndPlayerPublicIDs struct {
	PlayerPublicID    string `json:"playerPublicID"`
	RequestorPublicID string `json:"requestorPublicID"`
}

BasePayloadWithRequestorAndPlayerPublicIDs maps the payload required for many routes

func (BasePayloadWithRequestorAndPlayerPublicIDs) MarshalEasyJSON added in v0.9.15

MarshalEasyJSON supports easyjson.Marshaler interface

func (*BasePayloadWithRequestorAndPlayerPublicIDs) UnmarshalEasyJSON added in v0.9.15

func (v *BasePayloadWithRequestorAndPlayerPublicIDs) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*BasePayloadWithRequestorAndPlayerPublicIDs) Validate added in v0.9.15

Validate all the required fields

type BodyExtractionMiddleware added in v0.11.1

type BodyExtractionMiddleware struct{}

BodyExtractionMiddleware extracts the body

func NewBodyExtractionMiddleware added in v0.11.1

func NewBodyExtractionMiddleware() *BodyExtractionMiddleware

NewBodyExtractionMiddleware with API version

func (*BodyExtractionMiddleware) Serve added in v0.11.1

Serve serves the middleware

type CreateClanPayload added in v0.9.15

type CreateClanPayload struct {
	PublicID         string                 `json:"publicID"`
	Name             string                 `json:"name"`
	OwnerPublicID    string                 `json:"ownerPublicID"`
	Metadata         map[string]interface{} `json:"metadata"`
	AllowApplication bool                   `json:"allowApplication"`
	AutoJoin         bool                   `json:"autoJoin"`
}

CreateClanPayload maps the payload for the Create Clan route

func (CreateClanPayload) MarshalEasyJSON added in v0.9.15

func (v CreateClanPayload) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*CreateClanPayload) UnmarshalEasyJSON added in v0.9.15

func (v *CreateClanPayload) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CreateClanPayload) Validate added in v0.9.15

func (ccp *CreateClanPayload) Validate() []string

Validate all the required fields for creating a clan

type CreateGamePayload added in v0.9.15

type CreateGamePayload struct {
	PublicID                      string                 `json:"publicID"`
	Name                          string                 `json:"name"`
	MembershipLevels              map[string]interface{} `json:"membershipLevels"`
	Metadata                      map[string]interface{} `json:"metadata"`
	MinLevelToAcceptApplication   int                    `json:"minLevelToAcceptApplication"`
	MinLevelToCreateInvitation    int                    `json:"minLevelToCreateInvitation"`
	MinLevelToRemoveMember        int                    `json:"minLevelToRemoveMember"`
	MinLevelOffsetToRemoveMember  int                    `json:"minLevelOffsetToRemoveMember"`
	MinLevelOffsetToPromoteMember int                    `json:"minLevelOffsetToPromoteMember"`
	MinLevelOffsetToDemoteMember  int                    `json:"minLevelOffsetToDemoteMember"`
	MaxMembers                    int                    `json:"maxMembers"`
	MaxClansPerPlayer             int                    `json:"maxClansPerPlayer"`
	CooldownAfterDeny             int                    `json:"cooldownAfterDeny"`
	CooldownAfterDelete           int                    `json:"cooldownAfterDelete"`
}

CreateGamePayload maps the payload required for the Create game route

func (CreateGamePayload) MarshalEasyJSON added in v0.9.15

func (v CreateGamePayload) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*CreateGamePayload) UnmarshalEasyJSON added in v0.9.15

func (v *CreateGamePayload) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CreateGamePayload) Validate added in v0.9.15

func (p *CreateGamePayload) Validate() []string

Validate the create game payload

type CreatePlayerPayload added in v0.9.15

type CreatePlayerPayload struct {
	PublicID string                 `json:"publicID"`
	Name     string                 `json:"name"`
	Metadata map[string]interface{} `json:"metadata"`
}

CreatePlayerPayload maps the payload for the Create Player route

func (CreatePlayerPayload) MarshalEasyJSON added in v0.9.15

func (v CreatePlayerPayload) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*CreatePlayerPayload) UnmarshalEasyJSON added in v0.9.15

func (v *CreatePlayerPayload) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CreatePlayerPayload) Validate added in v0.9.15

func (cpp *CreatePlayerPayload) Validate() []string

Validate all the required fields for creating a player

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

Dispatcher is responsible for sending web hooks to workers

func NewDispatcher

func NewDispatcher(app *App) (*Dispatcher, error)

NewDispatcher creates a new dispatcher available to our app

func (*Dispatcher) DispatchHook

func (d *Dispatcher) DispatchHook(gameID string, eventType int, payload map[string]interface{})

DispatchHook dispatches an event hook for eventType to gameID with the specified payload

func (*Dispatcher) PerformDispatchHook

func (d *Dispatcher) PerformDispatchHook(m *workers.Msg)

PerformDispatchHook dispatches web hooks for a specific game and event type

type EasyJSONMarshaler added in v0.9.15

type EasyJSONMarshaler interface {
	MarshalEasyJSON(w *jwriter.Writer)
}

EasyJSONMarshaler describes a struct able to marshal json

type EasyJSONUnmarshaler added in v0.9.15

type EasyJSONUnmarshaler interface {
	UnmarshalEasyJSON(l *jlexer.Lexer)
}

EasyJSONUnmarshaler describes a struct able to unmarshal json

type HookPayload added in v0.9.15

type HookPayload struct {
	Type    int    `json:"type"`
	HookURL string `json:"hookURL"`
}

HookPayload maps the payload required to create or update hooks

func (HookPayload) MarshalEasyJSON added in v0.9.15

func (v HookPayload) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*HookPayload) UnmarshalEasyJSON added in v0.9.15

func (v *HookPayload) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*HookPayload) Validate added in v0.9.15

func (hp *HookPayload) Validate() []string

Validate all the required fields

type InviteForMembershipPayload added in v0.9.15

type InviteForMembershipPayload struct {
	Level             string `json:"level"`
	PlayerPublicID    string `json:"playerPublicID"`
	RequestorPublicID string `json:"requestorPublicID"`
}

InviteForMembershipPayload maps the payload required for the Invite for Membership route

func (InviteForMembershipPayload) MarshalEasyJSON added in v0.9.15

func (v InviteForMembershipPayload) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*InviteForMembershipPayload) UnmarshalEasyJSON added in v0.9.15

func (v *InviteForMembershipPayload) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*InviteForMembershipPayload) Validate added in v0.9.15

func (ifmp *InviteForMembershipPayload) Validate() []string

Validate all the required fields

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 added in v0.10.0

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

NewRelicMiddleware is responsible for logging to Zap all requests

func NewNewRelicMiddleware added in v0.10.0

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

NewNewRelicMiddleware returns the logger middleware

func (*NewRelicMiddleware) Serve added in v0.10.0

Serve serves the middleware

type RecoveryMiddleware

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

RecoveryMiddleware recovers from errors

func NewRecoveryMiddleware added in v0.9.15

func NewRecoveryMiddleware(onError func(error, []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 added in v0.9.15

func NewSentryMiddleware(app *App) *SentryMiddleware

NewSentryMiddleware returns a new sentry middleware

func (*SentryMiddleware) Serve

Serve serves the middleware

type TransferClanOwnershipPayload added in v0.9.15

type TransferClanOwnershipPayload struct {
	PlayerPublicID string `json:"playerPublicID"`
}

TransferClanOwnershipPayload maps the payload for the Transfer Clan Ownership route

func (TransferClanOwnershipPayload) MarshalEasyJSON added in v0.9.15

func (v TransferClanOwnershipPayload) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*TransferClanOwnershipPayload) UnmarshalEasyJSON added in v0.9.15

func (v *TransferClanOwnershipPayload) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TransferClanOwnershipPayload) Validate added in v0.9.15

func (tcop *TransferClanOwnershipPayload) Validate() []string

Validate all the required fields for transferring a clan ownership

type UpdateClanPayload added in v0.9.15

type UpdateClanPayload struct {
	Name             string                 `json:"name"`
	OwnerPublicID    string                 `json:"ownerPublicID"`
	Metadata         map[string]interface{} `json:"metadata"`
	AllowApplication bool                   `json:"allowApplication"`
	AutoJoin         bool                   `json:"autoJoin"`
}

UpdateClanPayload maps the payload for the Update Clan route

func (UpdateClanPayload) MarshalEasyJSON added in v0.9.15

func (v UpdateClanPayload) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*UpdateClanPayload) UnmarshalEasyJSON added in v0.9.15

func (v *UpdateClanPayload) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UpdateClanPayload) Validate added in v0.9.15

func (ucp *UpdateClanPayload) Validate() []string

Validate all the required fields for updating a clan

type UpdateGamePayload added in v0.9.15

type UpdateGamePayload struct {
	Name                          string                 `json:"name"`
	MembershipLevels              map[string]interface{} `json:"membershipLevels"`
	Metadata                      map[string]interface{} `json:"metadata"`
	MinLevelToAcceptApplication   int                    `json:"minLevelToAcceptApplication"`
	MinLevelToCreateInvitation    int                    `json:"minLevelToCreateInvitation"`
	MinLevelToRemoveMember        int                    `json:"minLevelToRemoveMember"`
	MinLevelOffsetToRemoveMember  int                    `json:"minLevelOffsetToRemoveMember"`
	MinLevelOffsetToPromoteMember int                    `json:"minLevelOffsetToPromoteMember"`
	MinLevelOffsetToDemoteMember  int                    `json:"minLevelOffsetToDemoteMember"`
	MaxMembers                    int                    `json:"maxMembers"`
	MaxClansPerPlayer             int                    `json:"maxClansPerPlayer"`
	CooldownAfterDeny             int                    `json:"cooldownAfterDeny"`
	CooldownAfterDelete           int                    `json:"cooldownAfterDelete"`
}

UpdateGamePayload maps the payload required for the Update game route

func (UpdateGamePayload) MarshalEasyJSON added in v0.9.15

func (v UpdateGamePayload) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*UpdateGamePayload) UnmarshalEasyJSON added in v0.9.15

func (v *UpdateGamePayload) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UpdateGamePayload) Validate added in v0.9.15

func (p *UpdateGamePayload) Validate() []string

Validate the update game payload

type UpdatePlayerPayload added in v0.9.15

type UpdatePlayerPayload struct {
	Name     string                 `json:"name"`
	Metadata map[string]interface{} `json:"metadata"`
}

UpdatePlayerPayload maps the payload for the Update Player route

func (UpdatePlayerPayload) MarshalEasyJSON added in v0.9.15

func (v UpdatePlayerPayload) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*UpdatePlayerPayload) UnmarshalEasyJSON added in v0.9.15

func (v *UpdatePlayerPayload) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UpdatePlayerPayload) Validate added in v0.9.15

func (upp *UpdatePlayerPayload) Validate() []string

Validate all the required fields for updating a player

type Validatable added in v0.9.15

type Validatable interface {
	Validate() []string
}

Validatable indicates that a struct can be validated

type Validation added in v0.9.15

type Validation struct {
	// contains filtered or unexported fields
}

Validation struct

func NewValidation added in v0.9.15

func NewValidation() *Validation

NewValidation for validating structs

func (*Validation) Errors added in v0.9.15

func (v *Validation) Errors() []string

Errors in validation

func (Validation) MarshalEasyJSON added in v0.9.15

func (v Validation) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Validation) UnmarshalEasyJSON added in v0.9.15

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 added in v0.9.15

func NewVersionMiddleware() *VersionMiddleware

NewVersionMiddleware with API version

func (*VersionMiddleware) Serve

Serve serves the middleware

Jump to

Keyboard shortcuts

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