cron

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package cron stores recurring task definitions and run history.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDue

func IsDue(entry Entry, now time.Time) bool

Types

type Entry

type Entry struct {
	ID          string     `json:"cron_id"`
	Schedule    string     `json:"schedule"`
	Prompt      string     `json:"prompt"`
	Description string     `json:"description,omitempty"`
	Enabled     bool       `json:"enabled"`
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
	LastRunAt   *time.Time `json:"last_run_at,omitempty"`
	RunCount    int        `json:"run_count"`
}

type Store

type Store struct {
	ConfigHome string
}

func NewStore

func NewStore(configHome string) Store

func (Store) Create

func (s Store) Create(schedule string, prompt string, description string) (Entry, error)

func (Store) Delete

func (s Store) Delete(id string) (Entry, error)

func (Store) Due

func (s Store) Due(now time.Time) ([]Entry, error)

func (Store) Get

func (s Store) Get(id string) (Entry, error)

Get returns one scheduled entry by ID.

func (Store) List

func (s Store) List() ([]Entry, error)

func (Store) MarkRun

func (s Store) MarkRun(id string, now time.Time) (Entry, error)

func (Store) SetEnabled

func (s Store) SetEnabled(id string, enabled bool) (Entry, error)

SetEnabled changes whether a scheduled entry can become due.

Jump to

Keyboard shortcuts

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