Help us shape the future of Go! Take the 2026 Go Developer Survey

scheduler

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: Apache-2.0 Imports: 1 Imported by: 5

README

goscheduler Build Status Coverage Status

goscheduler - Golang package providing function for executing task periodically. Optionaly you can add delay on task start.

Example usage (also included in example catalog)

package main

import (
	"fmt"
	"time"

	"github.com/jtaczanowski/go-scheduler"
)

func main() {
	// run function exampleTask() every 10s
	scheduler.RunTaskAtInterval(exampleTask, time.Second*10, time.Second*0)

	// run function exampleTask() every 10s, but delay on start by 3 second
	scheduler.RunTaskAtInterval(exampleTask, time.Second*10, time.Second*3)

	// run function exampleTaskWithArguments("example task with arguments") every 10s
	scheduler.RunTaskAtInterval(
		func() { exampleTaskWithArguments("example task with arguments") },
		time.Second*10,
		time.Second*0,
	)
}

func exampleTask() {
	fmt.Print("example")
}

func exampleTaskWithArguments(str string) {
	fmt.Print(str)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTaskAtInterval

func RunTaskAtInterval(funcToRun func(), interval time.Duration, startDelay time.Duration)

RunTaskAtInterval - run funcion every specified time interval, optionaly you can add delay at start

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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