httpworker

package module
v0.0.0-...-eb6014d Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

README

httpworker

Go HTTP worker compatible with Voi SVC https://github.com/voi-oss/svc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(w *Worker)

Option is a functional option for configuring the Worker.

func WithAddress

func WithAddress(addr string) Option

WithAddress sets the address for the Worker. Default is ":8080".

func WithRouter

func WithRouter(router chi.Router) Option

WithRouter sets the chi router for the Worker.

func WithShutdownCtx

func WithShutdownCtx(ctx context.Context) Option

WithShutdownCtx sets the context for the Worker's shutdown timeout.

type Worker

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

Worker is a svc.Worker implementation that uses the go-chi/chi router.

func New

func New(logger *zap.Logger, opts ...Option) *Worker

New creates a new Worker with the provided logger and options.

func (*Worker) Alive

func (w *Worker) Alive() error

Alive checks if the server is running by making a request to the health check route.

func (*Worker) Init

func (w *Worker) Init(logger *zap.Logger) error

func (*Worker) Run

func (w *Worker) Run() error

func (*Worker) Terminate

func (w *Worker) Terminate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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