middleware

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: AGPL-3.0 Imports: 7 Imported by: 2 modules, 1 package

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

Overview

Package middleware provides some middleware

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogMiddleware

func LogMiddleware(c *gin.Context)

LogMiddleware is an middleware to log requests to rs/zerolog and catches panics. If it is added multiple times, only the first time sends entries to the log.

func RequireUser

func RequireUser(c *gin.Context)

RequireUser is an middleware that looks if the user is an Anonymous user and redircts it to the login if so.

Types

type Config

type Config map[string]any

Config is the type For Configuration of the Middleware

type Middleware

type Middleware interface {
	Gin(*gin.Context)
	Defaults() Config
	Setup(Config)
	Teardown()
}

Middleware is an type to Save data between executions and to provide help at the teardown.

type PostSetupMiddleware added in v0.4.1

type PostSetupMiddleware interface {
	Middleware
	PostSetup([]any) error
}

PostSetupMiddleware is for middleware that requires sites to be already configured

type PreSetupMiddleware added in v0.4.1

type PreSetupMiddleware interface {
	Middleware
	PreSetup([]any) error
}

PreSetupMiddleware is for middleware that only needs the sites after their initialization

Directories

Path Synopsis
Package db is an middleware that manages multiple database pools and provides applications with an way to access the database
Package db is an middleware that manages multiple database pools and provides applications with an way to access the database
Package wellknown provides an middleware that lets sites to register themselfs to wellknown uris
Package wellknown provides an middleware that lets sites to register themselfs to wellknown uris

Jump to

Keyboard shortcuts

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