dispatcher

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher[
	HC proto.IHandlerContainer,
	E proto.IErrToApiProcessor,
] struct {
	DefaultHeaders map[string]string
	// contains filtered or unexported fields
}

func New

func New[
	HC proto.IHandlerContainer,
	E proto.IErrToApiProcessor,
](
	handlers HC,
	err_to_api E,
	def_headers map[string]string,
	middlewares []proto.IMiddleware,
) *Dispatcher[HC, E]

func (*Dispatcher[HC, E]) Dispatch

func (self *Dispatcher[HC, E]) Dispatch(req proto.IRawRequest) types.InternalResponse

type MErrArg

type MErrArg struct {
	MReqArg
	// contains filtered or unexported fields
}

func (*MErrArg) GetErr

func (self *MErrArg) GetErr() error

type MReqArg

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

func (*MReqArg) Context

func (self *MReqArg) Context() map[string]any

func (*MReqArg) HeaderGet added in v0.14.0

func (self *MReqArg) HeaderGet(key string) string

func (*MReqArg) HeaderGetMany added in v0.14.0

func (self *MReqArg) HeaderGetMany(key string) []string

func (*MReqArg) HeaderSet added in v0.14.0

func (self *MReqArg) HeaderSet(key, val string)

func (*MReqArg) Method

func (self *MReqArg) Method() string

func (*MReqArg) Path

func (self *MReqArg) Path() string

type MRespArg

type MRespArg struct {
	MReqArg
	// contains filtered or unexported fields
}

func (*MRespArg) GetBody

func (self *MRespArg) GetBody() []byte

func (*MRespArg) GetStatus

func (self *MRespArg) GetStatus() int

func (*MRespArg) SetStatus

func (self *MRespArg) SetStatus(status int)

type SeparatedMiddleware

type SeparatedMiddleware struct {
	OnReq  []func(proto.IMiddlewareReqArg) error
	OnResp []func(proto.IMiddlewareRespArg) error
	OnErr  []func(proto.IMiddlewareErrArg) error
}

func SeparateMiddleware

func SeparateMiddleware(src []proto.IMiddleware) SeparatedMiddleware

Jump to

Keyboard shortcuts

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