task

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Entry added in v0.1.3

func Entry(entryID cron.EntryID) cron.Entry

Entry get entry

func GetJob

func GetJob(key string) (string, cron.Job, bool)

GetJob get job

func RemoveJob

func RemoveJob(key string) error

RemoveJob remove job

func UpdateJob

func UpdateJob(key string, spec string, job cron.Job) error

UpdateJob update or create job

Types

type Option

type Option func(*options)

Option params set

func WithSchedule

func WithSchedule(key string, spec string, job cron.Job) Option

WithSchedule set schedule

func WithStorage added in v0.1.3

func WithStorage(s Storage) Option

WithStorage set storage

type Server

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

Server manage

func New

func New(opts ...Option) *Server

New server

func (*Server) Options

func (e *Server) Options(opts ...Option)

Options set options

func (*Server) Shutdown

func (e *Server) Shutdown(_ context.Context) error

Shutdown server

func (*Server) Start

func (e *Server) Start(ctx context.Context) error

Start server

func (*Server) String

func (e *Server) String() string

String server name

type Storage added in v0.1.3

type Storage interface {
	Get(key string) (entryID cron.EntryID, spec string, job cron.Job, exist bool, err error)
	Set(key string, entryID cron.EntryID, spec string, job cron.Job) error
	Update(key string, entryID cron.EntryID) error
	Remove(key string) error
	ListKeys() ([]string, error)
}

Storage storage interface

Jump to

Keyboard shortcuts

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