controllers

package
v0.13.52 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const ControllersTag = `group:"controllers"`
View Source
const MethodAny = "any"

MethodAny is a special value to pass for the Method key in a HandlerMap to call RouterGroup.Any instead of RouterGroup.METHOD. It is chosen so that it cannot overlap with any valid HTTP method.

Variables

Functions

func Register added in v0.13.0

func Register(router gin.IRouter, root string, endpoints HandlerMap) *gin.RouterGroup

RegisterMap is a helper for making many calls to RouterGroup.METHOD(...), using a table-driven approach. As a special case, if the Method in a map entry is "any", it will call RouterGroup.Any instead of a method-specific handler. As another special case, `nil` handlers will be replaced with a default handler that returns HTTP 501 Not Implemented.

func SupplyController added in v0.13.0

func SupplyController(c Controller) fx.Option

Types

type Controller added in v0.13.0

type Controller interface {
	Register(gin.IRouter) error
}

Controller defines the interface for a controller that can register its routes against a (gin) router.

type DelayInjectorController added in v0.8.0

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

func (*DelayInjectorController) DeleteDelay added in v0.8.0

func (cc *DelayInjectorController) DeleteDelay(c *gin.Context)

func (*DelayInjectorController) GetDelay added in v0.8.0

func (cc *DelayInjectorController) GetDelay(c *gin.Context)

func (*DelayInjectorController) PutDelay added in v0.8.0

func (cc *DelayInjectorController) PutDelay(c *gin.Context)

func (*DelayInjectorController) Register added in v0.8.0

func (cc *DelayInjectorController) Register(router gin.IRouter) error

type FaultInjectorController

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

func (*FaultInjectorController) AddDescriptor

func (f *FaultInjectorController) AddDescriptor(c *gin.Context)

func (*FaultInjectorController) GetDescriptors

func (f *FaultInjectorController) GetDescriptors(c *gin.Context)

func (*FaultInjectorController) Register

func (f *FaultInjectorController) Register(router gin.IRouter) error

type HandlerMap added in v0.13.0

type HandlerMap = map[struct{ Method, Path string }]gin.HandlerFunc

HandlerMap defines a mapping from pairs of (method, path) to a handler function for a route. It is used in RegisterMap for a controller to add its routes in a table-driven format.

type KillController added in v0.13.0

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

func (*KillController) HandleKill added in v0.13.0

func (k *KillController) HandleKill(c *gin.Context)

func (*KillController) HandleShutdown added in v0.13.0

func (k *KillController) HandleShutdown(c *gin.Context)

func (*KillController) Register added in v0.13.0

func (k *KillController) Register(router gin.IRouter) error

type LogController added in v0.13.0

type LogController struct {
}

func (*LogController) GetLevels added in v0.13.0

func (*LogController) GetLevels(c *gin.Context)

func (*LogController) Register added in v0.13.0

func (lc *LogController) Register(router gin.IRouter) error

func (*LogController) SetComponentLevel added in v0.13.0

func (lc *LogController) SetComponentLevel(c *gin.Context)

type UptimeController added in v0.13.0

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

func (*UptimeController) Handle added in v0.13.0

func (u *UptimeController) Handle(c *gin.Context)

func (*UptimeController) HandleSlow added in v0.13.0

func (u *UptimeController) HandleSlow(c *gin.Context)

func (*UptimeController) Register added in v0.13.0

func (u *UptimeController) Register(router gin.IRouter) error

Jump to

Keyboard shortcuts

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