middleware

package
v0.0.0-...-59c05e5 Latest Latest
Warning

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

Go to latest
Published: May 23, 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 DispatchEncoder](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 DispatchLogger](format string, logger io.Writer) dispatch.Middleware[R]

func SessionMW

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

Types

type ContentEncoder

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

type DefaultSessionStore

type DefaultSessionStore[S Session] struct {
	CookieName string

	sync.Map
	// contains filtered or unexported fields
}

func NewDefaultSessionStore

func NewDefaultSessionStore[S Session](cookieName string) *DefaultSessionStore[S]

func (*DefaultSessionStore[S]) Load

func (store *DefaultSessionStore[S]) Load(r *http.Request) 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 DispatchEncoder

type DispatchEncoder interface {
	dispatch.RequestAdapter
	Encoder() *EncodingData
}

type DispatchLogger

type DispatchLogger interface {
	dispatch.RequestAdapter
	Log() *LoggerData
}

type EncodingData

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

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 LoggerData

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

type Session

type Session interface {
	Id() string
}

type SessionAdapter

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

type SessionStore

type SessionStore[S Session] interface {
	Load(*http.Request) 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