handlers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 7 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

View Source
const (
	CategoryEvent = "Event"
	CategoryUser  = "User"
)

Categories for handlers

Variables

This section is empty.

Functions

func Index

func Index(w http.ResponseWriter, r *http.Request)

Types

type BaseHandler

type BaseHandler struct {
	http.Handler

	Name     string
	Category string

	DB *gorm.DB
}

BaseHandler This is the base handler all the handlers extend

func NewBaseHandler

func NewBaseHandler(db *gorm.DB) BaseHandler

func (*BaseHandler) WriteResponse

func (b *BaseHandler) WriteResponse(w http.ResponseWriter, reqCtx *ReqContext)

type GetEvents

type GetEvents struct {
	http.Handler
	Name     string
	Category string
	DB       *gorm.DB
	CORS     string
}

func (GetEvents) ServeHTTP

func (h GetEvents) ServeHTTP(w http.ResponseWriter, r *http.Request)

type GetEventsRequest

type GetEventsRequest struct {
	Limit int `json:"limit" yaml:"limit"`
}

type GetEventsResponse

type GetEventsResponse struct {
	Status int            `json:"status" yaml:"status"`
	Data   []models.Event `json:"data" yaml:"data"`
}

type PrometheusHandler

type PrometheusHandler struct {
	Path    string
	Handle  http.HandlerFunc
	Metrics *metrics.Metrics
}

Handler is an HTTP handle for serving metric data

func NewPrometheusHandler

func NewPrometheusHandler() *PrometheusHandler

New is a factory function creating a new Metrics instance

type ReqContext

type ReqContext struct {
	ErrorCode   string `json:"errorCode"`
	ErrorDetail string `json:"errorDetail"`

	HTTPStatusCode int `json:"httpStatus"`
	// Reply can be any type convertible to valid JSON
	HTTPReply interface{}
}

Jump to

Keyboard shortcuts

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