middleware

package
v0.0.0-...-ddc5d82 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentEncoding

func ContentEncoding[R dispatch.RequestAdapter](withProviders ...ContentEncoder) dispatch.Middleware[R]

func Errors

func Errors[R dispatch.RequestAdapter, E ~int]() errorHandler[R, E]

Factory function to create an error handler middleware

func Logger

func Logger[R dispatch.RequestAdapter](format string, logger io.Writer) dispatch.Middleware[R]

func SessionMW

func SessionMW[S Session, R SessionAdapter[S]](store SessionStore[S], init func() S, log io.Writer) dispatch.Middleware[R]

Types

type ContentEncoder

type ContentEncoder interface {
	Name() string
	Create(io.Writer) io.Writer
}

type DefaultSessionStore

type DefaultSessionStore[S Session] struct{ sync.Map }

func (*DefaultSessionStore[S]) GetSession

func (store *DefaultSessionStore[S]) GetSession(r *http.Request, init func() S) S

func (*DefaultSessionStore[S]) StoreSession

func (store *DefaultSessionStore[S]) StoreSession(s S) error

func (*DefaultSessionStore[S]) WriteCookie

func (store *DefaultSessionStore[S]) WriteCookie(w http.ResponseWriter, s S)

type ErrorHandler

type ErrorHandler[R dispatch.RequestAdapter] interface {
	Self() func(ctn *dispatch.ContentTypeNegotiator, logger io.Writer) dispatch.Middleware[R]
	// contains filtered or unexported methods
}

type Session

type Session interface {
	Id() string
}

type SessionAdapter

type SessionAdapter[S Session] interface {
	dispatch.RequestAdapter
	LoadSession(S)
}

type SessionStore

type SessionStore[S Session] interface {
	GetSession(*http.Request, func() S) S
	StoreSession(S) error
	WriteCookie(http.ResponseWriter, S)
}

type WriteFlusher

type WriteFlusher interface {
	io.Writer
	Flush() error
}

Jump to

Keyboard shortcuts

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