server

package
v0.0.0-...-c5ca51d Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServeCtxKeyEnvPort = ServeCtxKeyType("ServeCtxKeyEnvPort")

	DefaultPort = 8080
)

Variables

This section is empty.

Functions

func HealthCheckHandler

func HealthCheckHandler(w http.ResponseWriter, r *http.Request)

func NewRouter

func NewRouter() *mux.Router

func OpenAPIDocHandler

func OpenAPIDocHandler(w http.ResponseWriter, r *http.Request)

func Serve

func Serve(ctx context.Context, s Scope, errChan chan<- error)

Types

type Scheduler

type Scheduler struct {
	WG    sync.WaitGroup
	Tasks []Task
}

func (*Scheduler) Add

func (s *Scheduler) Add(ctx context.Context, name string, periodicity time.Duration, Func TaskFunc)

func (*Scheduler) Start

func (s *Scheduler) Start(ctx context.Context)

type Scope

type Scope interface {
	Route(*mux.Router)
}

type ServeCtxKeyType

type ServeCtxKeyType string

type Task

type Task struct {
	Name        string
	Periodicity time.Duration
	Func        TaskFunc
	Ctx         context.Context
}

func (*Task) Start

func (t *Task) Start()

type TaskFunc

type TaskFunc func(context.Context) bool

Jump to

Keyboard shortcuts

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