cron

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	ID             string   `json:"id"`
	Name           string   `json:"name"`
	Enabled        bool     `json:"enabled"`
	Schedule       Schedule `json:"schedule"`
	Payload        Payload  `json:"payload"`
	State          State    `json:"state"`
	CreatedAtMS    int64    `json:"createdAtMs"`
	UpdatedAtMS    int64    `json:"updatedAtMs"`
	DeleteAfterRun bool     `json:"deleteAfterRun,omitempty"`
}

type Payload

type Payload struct {
	Kind    string `json:"kind"` // "agent_turn"
	Message string `json:"message"`
	Deliver bool   `json:"deliver"`
	Channel string `json:"channel,omitempty"`
	To      string `json:"to,omitempty"`
}

type Schedule

type Schedule struct {
	Kind    string `json:"kind"` // "at" | "every" | "cron"
	AtMS    int64  `json:"atMs,omitempty"`
	EveryMS int64  `json:"everyMs,omitempty"`
	Expr    string `json:"expr,omitempty"`
	TZ      string `json:"tz,omitempty"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(storePath string, onJob func(ctx context.Context, job Job) (string, error)) *Service

func (*Service) Add

func (s *Service) Add(name string, sched Schedule, payload Payload) (Job, error)

func (*Service) List

func (s *Service) List(includeDisabled bool) []Job

func (*Service) Remove

func (s *Service) Remove(id string) bool

func (*Service) RunNow

func (s *Service) RunNow(ctx context.Context, id string, force bool) (string, error)

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

func (*Service) Stop

func (s *Service) Stop()

func (*Service) Toggle

func (s *Service) Toggle(id string, disable bool) bool

type State

type State struct {
	NextRunAtMS int64  `json:"nextRunAtMs,omitempty"`
	LastRunAtMS int64  `json:"lastRunAtMs,omitempty"`
	LastStatus  string `json:"lastStatus,omitempty"`
	LastError   string `json:"lastError,omitempty"`
}

type Store

type Store struct {
	Version int   `json:"version"`
	Jobs    []Job `json:"jobs"`
}

Jump to

Keyboard shortcuts

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