requestcontext

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB(r *http.Request) *gorm.DB

DB retrieves the database connection from the current request

func Hub

func Hub(r *http.Request) *hub.Hub

Hub retrieves the event hub from the current request

func Log

func Log(r *http.Request) *logrus.Logger

Log retrieves the log from the current request

func New

func New(store *gormstore.Store, db *gorm.DB, log *logrus.Logger, eventHub *hub.Hub) func(http.Handler) http.Handler

New creates a new Handler

func Store

func Store(r *http.Request) *gormstore.Store

Store retrieves the cookie store from the current request

Types

type Handler

type Handler struct {
	Store    *gormstore.Store
	DB       *gorm.DB
	Log      *logrus.Logger
	EventHub *hub.Hub
	// contains filtered or unexported fields
}

Handler implements a middleware allowing storage of relevant pointers for requests in the request context

func (Handler) ServeHTTP

func (m Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the actual middleware code

Jump to

Keyboard shortcuts

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