adaptor

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHertzHTTPHandler

func NewHertzHTTPHandler(h http.Handler) app.HandlerFunc

NewHertzHTTPHandler wraps net/http handler to hertz app.HandlerFunc, so it can be passed to hertz server

While this function may be used for easy switching from net/http to hertz, it has the following drawbacks comparing to using manually written hertz request handler:

  • A lot of useful functionality provided by hertz is missing from net/http handler.

  • net/http -> hertz handler conversion has some overhead, so the returned handler will be always slower than manually written hertz handler.

So it is advisable using this function only for net/http -> hertz switching. Then manually convert net/http handlers to hertz handlers

func NewHertzHTTPHandlerFunc

func NewHertzHTTPHandlerFunc(h http.HandlerFunc) app.HandlerFunc

NewHertzHTTPHandlerFunc wraps net/http handler to hertz app.HandlerFunc, so it can be passed to hertz server

While this function may be used for easy switching from net/http to hertz, it has the following drawbacks comparing to using manually written hertz request handler:

  • A lot of useful functionality provided by hertz is missing from net/http handler.

  • net/http -> hertz handler conversion has some overhead, so the returned handler will be always slower than manually written hertz handler.

So it is advisable using this function only for net/http -> hertz switching. Then manually convert net/http handlers to hertz handlers

Types

This section is empty.

Jump to

Keyboard shortcuts

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