schedule

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeRepeat  = "repeat"
	TypeCron    = "cron"
	TypeSimple  = "simple"
	TypeSunrise = "sunrise"
	TypeSunset  = "sunset"
)

cron types

View Source
const (
	FrequencyDaily   = "daily"
	FrequencyWeekly  = "weekly"
	FrequencyMonthly = "monthly"
	FrequencyOnDate  = "on_date"
)

frequency types

View Source
const (
	CustomVariableTypeNone       = "none"
	CustomVariableTypeJavascript = "javascript"
	CustomVariableTypeWebhook    = "webhook"
)

Custom variable loader types

Variables

This section is empty.

Functions

func WithContext

func WithContext(ctx context.Context, scheduler CoreScheduler) context.Context

Types

type Config

type Config struct {
	ID                   string                 `json:"id" yaml:"id"`
	Description          string                 `json:"description" yaml:"description"`
	Enabled              bool                   `json:"enabled" yaml:"enabled"`
	Labels               cmap.CustomStringMap   `json:"labels" yaml:"labels"`
	Validity             Validity               `json:"validity" yaml:"validity"`
	Type                 string                 `json:"type" yaml:"type"`
	Spec                 cmap.CustomMap         `json:"spec" yaml:"spec"`
	Variables            map[string]interface{} `json:"variables" yaml:"variables"`
	CustomVariableType   string                 `json:"customVariableType" yaml:"customVariableType"`
	CustomVariableConfig CustomVariableConfig   `json:"customVariableConfig" yaml:"customVariableConfig"`
	HandlerParameters    map[string]interface{} `json:"handlerParameters" yaml:"handlerParameters"`
	Handlers             []string               `json:"handlers" yaml:"handlers"`
	ModifiedOn           time.Time              `json:"modifiedOn" yaml:"modifiedOn"`
	State                *State                 `json:"state" yaml:"state"`
}

Config for scheduler

type CoreScheduler

type CoreScheduler interface {
	Name() string
	Start() error
	Close() error
	AddFunc(name, spec string, targetFunc func()) error
	RemoveFunc(name string)
	RemoveWithPrefix(prefix string)
	ListNames() []string
	IsAvailable(id string) bool
}

func FromContext

func FromContext(ctx context.Context) (CoreScheduler, error)

type CustomVariableConfig

type CustomVariableConfig struct {
	Javascript string      `json:"javascript" yaml:"javascript"`
	Webhook    WebhookData `json:"webhook" yaml:"webhook"`
}

CustomVariableConfig struct

type DateRange

type DateRange struct {
	From dateTimeTY.CustomDate `json:"from" yaml:"from"`
	To   dateTimeTY.CustomDate `json:"to" yaml:"to"`
}

DateRange struct

type SpecCron

type SpecCron struct {
	CronExpression string
}

SpecCron struct

type SpecRepeat

type SpecRepeat struct {
	Interval    string
	RepeatCount int64
}

SpecRepeat struct

type SpecSimple

type SpecSimple struct {
	Frequency   string
	DayOfWeek   string
	DateOfMonth int
	Date        string
	Time        string
	Offset      string
}

SpecSimple struct

type State

type State struct {
	LastRun       time.Time `json:"lastRun" yaml:"lastRun"`
	LastStatus    bool      `json:"lastStatus" yaml:"lastStatus"`
	Message       string    `json:"message" yaml:"message"`
	ExecutedCount int64     `json:"executedCount" yaml:"executedCount"`
}

State struct

type TimeRange

type TimeRange struct {
	From dateTimeTY.CustomTime `json:"from" yaml:"from"`
	To   dateTimeTY.CustomTime `json:"to" yaml:"to"`
}

TimeRange struct

type Validity

type Validity struct {
	Enabled              bool      `json:"enabled" yaml:"enabled"`
	Date                 DateRange `json:"date" yaml:"date"`
	Time                 TimeRange `json:"time" yaml:"time"`
	ValidateTimeEveryday bool      `json:"validateTimeEveryday" yaml:"validateTimeEveryday"`
}

Validity of the scheduler

type WebhookData

type WebhookData struct {
	URL             string                 `json:"url" yaml:"url"`
	Method          string                 `json:"method" yaml:"method"`
	Insecure        bool                   `json:"insecure" yaml:"insecure"`
	Headers         map[string]string      `json:"headers" yaml:"headers"`
	QueryParameters map[string]interface{} `json:"queryParameters" yaml:"queryParameters"`
	IncludeConfig   bool                   `json:"includeConfig" yaml:"includeConfig"`
}

WebhookData struct

Jump to

Keyboard shortcuts

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