ddhttp

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient added in v0.2.3

func NewClient() *resty.Client

Types

type ChiHttpSrv

type ChiHttpSrv struct {
	*chi.Mux
	// contains filtered or unexported fields
}

TODO https://github.com/go-chi/chi

type DefaultHttpSrv

type DefaultHttpSrv struct {
	*mux.Router
	// contains filtered or unexported fields
}

gorilla

func (*DefaultHttpSrv) AddMiddleware

func (srv *DefaultHttpSrv) AddMiddleware(mwf ...func(http.Handler) http.Handler)

func (*DefaultHttpSrv) AddRoute

func (srv *DefaultHttpSrv) AddRoute(route ...Route)

func (*DefaultHttpSrv) Run

func (srv *DefaultHttpSrv) Run()

type IServiceProvider added in v0.2.3

type IServiceProvider interface {
	SelectServer() (string, error)
}

func NewServiceProvider added in v0.2.3

func NewServiceProvider(name string, opts ...ServiceProviderOption) IServiceProvider

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

type ServiceProvider added in v0.2.3

type ServiceProvider struct {
	Name string
}

func (*ServiceProvider) SelectServer added in v0.2.3

func (s *ServiceProvider) SelectServer() (string, error)

type ServiceProviderOption added in v0.2.3

type ServiceProviderOption func(IServiceProvider)

type Srv

type Srv interface {
	// Run the service
	Run()
	// Register routes
	AddRoute(route ...Route)
	// Use middleware
	AddMiddleware(mwf ...func(http.Handler) http.Handler)
}

func NewDefaultHttpSrv

func NewDefaultHttpSrv() Srv

Jump to

Keyboard shortcuts

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