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: 1

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