middleware

package
v0.35.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

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

func NewChain

func NewChain() *Chain

func (*Chain) Execute

func (c *Chain) Execute(ctx *Context, final HandlerFunc) error

func (*Chain) Use

func (c *Chain) Use(m Middleware) *Chain

type Context

type Context struct {
	Request  *http.Request
	Response http.ResponseWriter
	Params   map[string]string
	Locals   map[string]any
	// contains filtered or unexported fields
}

func NewContext

func NewContext(w http.ResponseWriter, r *http.Request) *Context

func (*Context) Get

func (c *Context) Get(key string) any

func (*Context) Next

func (c *Context) Next() error

func (*Context) Redirect

func (c *Context) Redirect(url string, status int)

func (*Context) Rewrite

func (c *Context) Rewrite(path string)

func (*Context) Set

func (c *Context) Set(key string, value any)

type HandlerFunc

type HandlerFunc func(*Context) error

type LoadedMiddleware

type LoadedMiddleware struct {
	OnRequest Middleware
	Sequence  []Middleware
}

func Load

func Load(projectDir string) (*LoadedMiddleware, error)

func LoadPlugin

func LoadPlugin(pluginPath string) (*LoadedMiddleware, error)

type Middleware

type Middleware func(*Context, func() error) error

func Sequence

func Sequence(middlewares ...Middleware) []Middleware

type MiddlewareCompiler

type MiddlewareCompiler struct {
	CacheDir   string
	BaseDir    string
	ModuleName string
	// contains filtered or unexported fields
}

func NewCompiler

func NewCompiler(baseDir, cacheDir string) *MiddlewareCompiler

func (*MiddlewareCompiler) Load

func (c *MiddlewareCompiler) Load(filePath string) (*LoadedMiddleware, error)

Jump to

Keyboard shortcuts

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