Skip to content

neomrc/go-worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-worker

Creates a simple worker function utilizing go routines and channels

Setup

go get github.com/neomrc/go-worker

Usage

import "github.com/neomrc/go-worker/src/worker"

// creates the handler
handler := worker.NewHandler(func() {
  fmt.Println("Hello, world!")
})
// set the interval for polling
handler.SetInterval(1000)

// initializes the worker instance
worker := worker.NewWorker()
// append the worker handler
worker.AddHandler("handler", handler)
// start the worker
worker.Start()

Run example

go mod download
go run example/main.go

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages