http

package
v0.3.6-beta Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 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(*ServiceOptions)

func WithContext

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

func WithHealthCheck

func WithHealthCheck[T *SidecarOptions | *ServiceOptions](healthChkFn HealthCheckFn) func(T)

func WithInitRoutesFn

func WithInitRoutesFn(i initRoutesFn) func(*ServiceOptions)

Setters

func WithName

func WithName(n string) func(*ServiceOptions)

func WithPrimaryService

func WithPrimaryService(svc *service.Base) func(*SidecarOptions)

func WithStackLevelOnError

func WithStackLevelOnError[T *SidecarOptions | *ServiceOptions](lvl StackLevel) func(T)

func WriteJSONBody

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

Types

type HealthCheckFn

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

type RecoveryFunc

type RecoveryFunc struct {
	StackLevel StackLevel
}

func (*RecoveryFunc) TryToRecover

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

type Service

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

func New

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

func NewSidecar

func NewSidecar(opts ...func(*SidecarOptions)) (*Service, error)

func (*Service) DoServe

func (s *Service) DoServe(listener net.Listener) error

func (*Service) Serve

func (s *Service) Serve() error

type ServiceOptions

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

type SidecarOptions

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

type StackLevel

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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