admin

package module
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2018 License: MIT Imports: 19 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAdminHandler

func NewAdminHandler(prefix, appName string, routes ...RouteConfig) http.Handler

func SetupAdminHandlerHTTPRouter

func SetupAdminHandlerHTTPRouter(router HTTPRouter, prefix, name string, routeConfigs ...RouteConfig)

func SetupAdminHandlerMux

func SetupAdminHandlerMux(mux *http.ServeMux, prefix, name string, routeConfigs ...RouteConfig)

Types

type BuildInfo

type BuildInfo struct {
	Version   string `json:",omitempty"`
	GitHash   string `json:",omitempty"`
	BuildTime string `json:",omitempty"`
}

type HTTPRouter

type HTTPRouter interface {
	Handler(method, path string, handler http.Handler)
}

type MetricsRegistry

type MetricsRegistry interface {
	GetOrRegister(string, interface{}) interface{}
	Register(string, interface{}) error
	RunHealthchecks()
	UnregisterAll()
}

We actually dont use any of those methods, but we want some kind of type safety for the WithMetrics() method, without depending on the metrics package.

type Route

type Route struct {
	Handler     http.Handler
	Method      string
	Path        string
	Description string
	// contains filtered or unexported fields
}

type RouteConfig

type RouteConfig struct {
	Route
	// contains filtered or unexported fields
}

func Describe

func Describe(desc string, rc RouteConfig) RouteConfig

func RequireAuth

func RequireAuth(user, pass string, configs ...RouteConfig) RouteConfig

func WithBuildInfo

func WithBuildInfo(buildInfo BuildInfo) RouteConfig

func WithDefaults

func WithDefaults() RouteConfig

func WithEnvironmentVariables

func WithEnvironmentVariables() RouteConfig

func WithForceGC

func WithForceGC() RouteConfig

func WithGCStats

func WithGCStats() RouteConfig

func WithGenericValue

func WithGenericValue(path string, value interface{}) RouteConfig

func WithGetHandler

func WithGetHandler(path string, handler http.Handler) RouteConfig

func WithGetHandlerFunc

func WithGetHandlerFunc(path string, handler http.HandlerFunc) RouteConfig

func WithHandler

func WithHandler(method, path string, handler http.Handler) RouteConfig

func WithHandlerFunc

func WithHandlerFunc(method, path string, handler http.HandlerFunc) RouteConfig

func WithHeapDump

func WithHeapDump() RouteConfig

func WithMetrics

func WithMetrics(registry MetricsRegistry) RouteConfig

func WithPProfHandlers

func WithPProfHandlers() RouteConfig

func WithPingPong

func WithPingPong() RouteConfig

func WithRedirect

func WithRedirect(from, to string) RouteConfig

func (RouteConfig) Describe

func (rc RouteConfig) Describe(description string) RouteConfig

func (RouteConfig) Wildcard

func (rc RouteConfig) Wildcard(wildcard bool) RouteConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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