Reminder is a Golang package to allow users to schedule alerts.

Codacy Badge Go Report Card

reminder

Reminder is a Golang package to allow users to schedule alerts. It has 4 parts:

  1. Scheduler
  2. Repeater
  3. Notifier
  4. Reminder

A scheduler takes in a time.Time for the first reminder to be sent.

A repeater applies rules to repeating a scheduled event - say at fixed intervals or on certain days

Repeaters can be combined (see examples)

The notifier defines how one gets notified. By default the beeep package is used to provide desktop notifications

The reminder pulls it all together, and allows the user to send a specified message on a given schedule.

Examples

Schedule a single event

package main

import (
	"fmt"
	"time"

	"github.com/KrishanBhalla/reminder"
	"github.com/KrishanBhalla/reminder/notify"
	"github.com/KrishanBhalla/reminder/schedule"
)

func main() {
	// Schedule an event
    format := time.RFC1123Z
	t := time.Now().Add(time.Minute)
    s, _ := schedule.NewSchedule(format, t.Format(format), "Local")
	// Create a reminder
    rem := reminder.Reminder{
        Schedule: s,
        Notifier: &notify.Desktop{},
    }

    err := rem.Remind("Reminder", "I'm a reminder made in Go!")
    fmt.Println(err)
}

One Repeater, Desktop Notifications

package main

import (
	"fmt"
	"time"

	"github.com/KrishanBhalla/reminder"
	"github.com/KrishanBhalla/reminder/notify"
	"github.com/KrishanBhalla/reminder/schedule"
)

func main() {

	// Schedule an event
    format := time.RFC1123Z
    s, _ := schedule.NewSchedule(format, time.Now().Format(format), "Local")

	// Repeat it every 5 seconds
    r := schedule.IntervalRepeater{
        Interval: time.Duration(5) * time.Second,
        NumTimes: 3,
    }
    r.Repeat(s)
	// Create the reminder
    rem := reminder.Reminder{
        Schedule: s,
        Notifier: &notify.Desktop{},
    }

    err := rem.Remind("Reminder", "I'm a reminder made in Go!")
    fmt.Println(err)
}

Combining Repeaters And Using Pushbullet

package main

import (
	"fmt"
	"time"

	"github.com/KrishanBhalla/reminder"
	"github.com/KrishanBhalla/reminder/notify"
	"github.com/KrishanBhalla/reminder/schedule"
)

func main() {

	// Schedule a reminder for right now
	format := time.RFC1123Z
	s, _ := schedule.NewSchedule(format, time.Now().Format(format), "Local")

	// Repeat it every hour for the next 8 hours
	r := schedule.IntervalRepeater{
		Interval: time.Hour,
		NumTimes: 8,
	}
	r.Repeat(s)

	// Repeat all of those reminders every day for a week
	wdayRem := schedule.DayOfWeekRepeater{
		Days:     []time.Weekday{time.Monday, time.Tuesday, time.Wednesday, time.Thursday, time.Friday},
		NumTimes: 5,
	}
	wdayRem.Repeat(s)

	notifier := notify.NewPushbullet("apiToken", "Device1", "Device2")
	rem := reminder.Reminder{
		Schedule: s,
		Notifier: notifier,
	}

	err := rem.Remind("Exercise", "Leave the desk and stretch your legs")
	fmt.Println(err)

}

Author

@KrishanBhalla

Road Map

  1. More thorough unit testing.
  2. Concurrency and simplification of setting up independent reminders.
  3. Other notification services
  4. UI

Credits

Owner
Quant / Data Scientist. Primarily Python + Golang Contributor to github.com/nikoksr/notify
null
Similar Resources

A lightweight job scheduler based on priority queue with timeout, retry, replica, context cancellation and easy semantics for job chaining. Build for golang web apps.

Table of Contents Introduction What is RIO? Concern An asynchronous job processor Easy management of these goroutines and chaining them Introduction W

Dec 9, 2022

Simple, efficient background processing for Golang backed by RabbitMQ and Redis

Simple, efficient background processing for Golang backed by RabbitMQ and Redis

Table of Contents How to Use Motivation Requirements Features Examples Setup Config Client/Server Task Worker/Task Hander Register The Handlers Send t

Nov 10, 2022

cpuworker - A Customized Goroutine Scheduler over Golang Runtime

cpuworker - A Customized Goroutine Scheduler over Golang Runtime

cpuworker Status Working in process. Run the Demo Make sure the GOMAXPROCS is bigger than 1 and there is at least GOMAXPROCS physical OS threads avail

Dec 6, 2022

YTask is an asynchronous task queue for handling distributed jobs in golang

YTask is an asynchronous task queue for handling distributed jobs in golang

YTask is an asynchronous task queue for handling distributed jobs in golang

Dec 24, 2022

goInterLock is golang job/task scheduler with distributed locking mechanism (by Using Redis🔒).

goInterLock is golang job/task scheduler with distributed locking mechanism (by Using Redis🔒).

goInterLock is golang job/task scheduler with distributed locking mechanism. In distributed system locking is preventing task been executed in every instant that has the scheduler,

Dec 5, 2022

a self terminating concurrent job queue for indeterminate workloads in golang

jobtracker - a self terminating concurrent job queue for indeterminate workloads in golang This library is primarily useful for technically-recursive

Sep 6, 2022

Scheduler CRUD For Golang

Scheduler CRUD For Golang

scheduler-CRUD 從dbdiagram.io建立table與create語法 在mysql建立table 以sqlc建CRUD function與Transaction 加入viper讀環境變量 以gin開發REST API 加入Dockerfile docker build -t th

Feb 10, 2022

Scheduler: the scheduler of distbuild written in Golang

scheduler Introduction scheduler is the scheduler of distbuild written in Go. Pr

Feb 9, 2022

Delay-tasks - A delayed tasks implementation for golang

Delay-tasks - A delayed tasks implementation for golang

delay-tasks An implementation of delayed tasks. Usage $ git clone https://github

Jan 14, 2022
Comments
  • Feature: Other notifiers

    Feature: Other notifiers

    Is your feature request related to a problem? Please describe. Add a service to interface slack, msteams etc.

    Describe the solution you'd like https://github.com/nikoksr/notify/ might be a useful library once stable.

  • Feature: Google Calendar integration

    Feature: Google Calendar integration

    Is your feature request related to a problem? Please describe. Define reminders and add them to google calendar. Equally take a google calendar event and remind multiple devices/users of it.

    Describe the solution you'd like https://developers.google.com/calendar/quickstart/go seems helpful

  • Feature: Persist reminders

    Feature: Persist reminders

    Is your feature request related to a problem? Please describe. Presently reminders are in-memory only, and disappear after execution is terminated.

    Describe the solution you'd like On restart of execution, recover all previous reminders still to occur, and add them to the queue. This would involve some storage of reminders, and some ID being assigned to groups to handle repetition.

Run Jobs on a schedule, supports fixed interval, timely, and cron-expression timers; Instrument your processes and expose metrics for each job.

A simple process manager that allows you to specify a Schedule that execute a Job based on a Timer. Schedule manage the state of this job allowing you to start/stop/restart in concurrent safe way. Schedule also instrument this Job and gather metrics and optionally expose them via uber-go/tally scope.

Dec 8, 2022
Easily schedule commands to run multiple times at set intervals (like a cronjob, but with one command)

hakcron Easily schedule commands to run multiple times at set intervals (like a cronjob, but for a single command) Description hakcron allows you to r

Aug 17, 2022
Crane scheduler is a Kubernetes scheduler which can schedule pod based on actual node load.

Crane-scheduler Overview Crane-scheduler is a collection of scheduler plugins based on scheduler framework, including: Dynamic scheuler: a load-aware

Dec 29, 2022
goCron: A Golang Job Scheduling Package.

goCron: A Golang Job Scheduling Package.

Jan 9, 2023
Package tasks is an easy to use in-process scheduler for recurring tasks in Go

Tasks Package tasks is an easy to use in-process scheduler for recurring tasks in Go. Tasks is focused on high frequency tasks that run quick, and oft

Dec 18, 2022
This package provides the way to get the previous timestamp or the next timestamp that satisfies the cron expression.

Cron expression parser Given a cron expression, you can get the previous timestamp or the next timestamp that satisfies the cron expression. I have us

May 3, 2022
Scheduler - Scheduler package is a zero-dependency scheduling library for Go

Scheduler Scheduler package is a zero-dependency scheduling library for Go Insta

Jan 14, 2022
a fake clock for golang

clockwork A simple fake clock for Go. Usage Replace uses of the time package with the clockwork.Clock interface instead. For example, instead of using

Dec 26, 2022
golang job dispatcher
golang job dispatcher

go-gearman The shardingkey is hashed to the same queue, each of which is bound to a worker.

Dec 28, 2022
Lightweight, fast and dependency-free Cron expression parser (due checker) for Golang (tested on v1.13 and above)

adhocore/gronx gronx is Golang cron expression parser ported from adhocore/cron-expr. Zero dependency. Very fast because it bails early in case a segm

Dec 30, 2022