cron

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

type Runner[T model.IEntry] struct {
	// contains filtered or unexported fields
}

func New

func New[T model.IEntry](opts RunnerOptions[T]) Runner[T]

func (Runner[T]) Start

func (r Runner[T]) Start(ctx context.Context) error

func (Runner[T]) Stop

func (r Runner[T]) Stop(_ context.Context) error

type RunnerOptions

type RunnerOptions[T model.IEntry] struct {
	Config  TasksConfig[T]
	Storage storage.Storage[T]
	Sender  sender.Serder[T]
}

type ScheduleTask

type ScheduleTask[A model.IEntry] interface {
	tasks.Task[A]
	GetSchedules() []string
	Chats() []int64
}

type Task

type Task[A model.IEntry, T tasks.Task[A]] struct {
	Config    T        `fig:"config"    yaml:"config"`
	Schedules []string `fig:"schedules" yaml:"schedules"`
	ChatIDs   []int64  `fig:"chats"     yaml:"chats"`
}

func (Task[A, T]) Chats

func (t Task[A, T]) Chats() []int64

func (Task[A, T]) GetSchedules

func (t Task[A, T]) GetSchedules() []string

func (Task[A, T]) Name

func (t Task[A, T]) Name() string

func (Task[A, T]) Run

func (t Task[A, T]) Run(ctx context.Context, opts tasks.TaskRunOptions[A]) error

type TaskAction

type TaskAction string
const (
	TaskSendLastEntries TaskAction = "send_last_entries"
)

type TasksConfig

type TasksConfig[T model.IEntry] struct {
	Timezone        *time.Location                    `fig:"-"                 yaml:"-"`
	SendLastEntries Task[T, tasks.SendLastEntries[T]] `fig:"send_last_entries" yaml:"send_last_entries"`
	SendLastStories Task[T, tasks.SendLastStories[T]] `fig:"send_last_stories" yaml:"send_last_stories"`
	Backup          Task[T, tasks.Backup[T]]          `fig:"backup"            yaml:"backup"`
	Cleanup         Task[T, tasks.Cleanup[T]]         `fig:"cleanup"           yaml:"cleanup"`
}

Jump to

Keyboard shortcuts

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