hertzbridge

package module
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapMiddleware added in v0.3.0

func WrapMiddleware(handlers ...app.HandlerFunc) treemux.MiddlewareFunc[*Handler]

WrapMiddleware wraps hertz handler functions into a treemux MiddlewareFunc.

Types

type Bridge added in v0.3.0

type Bridge struct {
	treemux.UnimplementedBridge[*Handler]
	// contains filtered or unexported fields
}

Bridge implements treemux.Bridge[*Handler] and can be used as a dynamic-configurable router.

func New

func New() *Bridge

New creates a new Bridge.

func (*Bridge) GetRouter added in v0.3.0

func (b *Bridge) GetRouter() *treemux.TreeMux[*Handler]

GetRouter returns the current router attached to this bridge.

func (*Bridge) IsHandlerValid added in v0.3.0

func (*Bridge) IsHandlerValid(handler *Handler) bool

func (*Bridge) Serve added in v0.3.0

func (b *Bridge) Serve(ctx context.Context, rc *app.RequestContext)

func (*Bridge) SetRouter added in v0.3.0

func (b *Bridge) SetRouter(mux *treemux.TreeMux[*Handler])

SetRouter changes the router of the bridge, it's safe to change the bridge's router concurrently. It also assigns the bridge to router.Bridge.

type Handler added in v0.3.0

type Handler struct {
	HandlersChain app.HandlersChain
}

func WrapHandler added in v0.3.0

func WrapHandler(handlers ...app.HandlerFunc) *Handler

WrapHandler wraps hertz handler functions into a *Handler.

Jump to

Keyboard shortcuts

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