http

package
v0.3.4-beta Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: BSD-2-Clause Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAddr

func WithAddr(a *string) func(*RouterOptions)

func WithContainer

func WithContainer(svc *service.Service) func(*ServiceOptions)

func WithContext

func WithContext(ctx context.Context) func(*RouterOptions)

func WithHealthCheck

func WithHealthCheck[T *ServiceOptions | *RouterOptions](healthChkFn HealthChkFn) func(T)

func WithInitRoutesFn

func WithInitRoutesFn(i initRoutesFn) func(*RouterOptions)

Setters

func WithName

func WithName(n string) func(*RouterOptions)

func WriteJSONBody

func WriteJSONBody(b *bytes.Buffer, body any, status int, altError string, w http.ResponseWriter)

Types

type HealthChkFn

type HealthChkFn = func(context.Context) (map[string]string, error)

type RecoveryFunc

type RecoveryFunc struct {
	StackLevel StackLevel
}

func (*RecoveryFunc) TryToRecover

func (s *RecoveryFunc) TryToRecover() mux.MiddlewareFunc

type RouterOptions

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

type Service

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

func NewWithServiceContainer

func NewWithServiceContainer(opts ...func(*ServiceOptions)) (*Service, error)

func NewWithWouter

func NewWithWouter(opts ...func(*RouterOptions)) (*Service, error)

func (*Service) Serve

func (s *Service) Serve() error

type ServiceOptions

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

type StackLevel

type StackLevel int
const (
	StackLevelSimple StackLevel = iota + 1
	StackLevelFullStack
)

Jump to

Keyboard shortcuts

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