middleware

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, plugin Handler)

Register a cmd to the manager.

Types

type Handler

type Handler interface {
	Next() func(handler http.Handler) http.Handler
}

type Manager

type Manager interface {
	HasMiddleware(name string) bool
	AddMiddleware(name string, middleware Handler)
	GetMiddleware(name ...string) ([]mux.MiddlewareFunc, error)
}

func GetMiddlewareManager

func GetMiddlewareManager() Manager

GetPluginManager gets the cmd manager instance (singleton).

type ManagerImpl

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

ManagerImpl is a manager for the plugins. It stores and maps the plugins to the command.

func (*ManagerImpl) AddMiddleware

func (pm *ManagerImpl) AddMiddleware(name string, plugin Handler)

AddMiddleware Add a middleware to the manager.

func (*ManagerImpl) GetMiddleware

func (pm *ManagerImpl) GetMiddleware(name ...string) ([]mux.MiddlewareFunc, error)

GetMiddleware returns the middleware, if found.

func (*ManagerImpl) HasMiddleware

func (pm *ManagerImpl) HasMiddleware(name string) bool

HasMiddleware Check if the cmd exists in the manager.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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