dou

package
v1.2.11 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2022 License: MIT Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func AddMiddleware

func AddMiddleware(mwf ...func(http.Handler) http.Handler)

AddMiddleware adds middlewares to the end of chain

func AddRoute

func AddRoute(route ...model.Route)

AddRoute adds routes to router

func BodyMaxBytes

func BodyMaxBytes(n int64) func(inner http.Handler) http.Handler

func BulkHead

func BulkHead(workers int, maxWaitTime time.Duration) func(inner http.Handler) http.Handler

BulkHead add bulk head pattern middleware based on https://github.com/slok/goresilience workers is the number of workers in the execution pool. maxWaitTime is the max time an incoming request will wait to execute before being dropped its execution and return 429 response.

func CallbackOnChange

func CallbackOnChange(listener *httpConfigListener) func(event *configmgr.NacosChangeEvent)

func InitialiseRemoteConfigListener

func InitialiseRemoteConfigListener()

func NewHttpConfigListener

func NewHttpConfigListener() *httpConfigListener

func PreMiddleware

func PreMiddleware(mwf ...func(http.Handler) http.Handler)

PreMiddleware adds middlewares to the head of chain

func RegisterCustomTypeFunc

func RegisterCustomTypeFunc(fn form.DecodeCustomTypeFunc, types ...interface{})

func Run

func Run(services ...interface{})

Run runs http server

Types

type HttpMethod

type HttpMethod int
const (
	UNKNOWN HttpMethod = iota
	POST
	GET
	PUT
	DELETE
)

func (HttpMethod) MarshalJSON

func (k HttpMethod) MarshalJSON() ([]byte, error)

func (*HttpMethod) StringGetter

func (k *HttpMethod) StringGetter() string

func (*HttpMethod) StringSetter

func (k *HttpMethod) StringSetter(value string)

func (*HttpMethod) UnmarshalJSON

func (k *HttpMethod) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

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