time

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: ISC Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func DeleteSubscription

func DeleteSubscription(conn pg.Conn, id eventline.Id) error

func NextDay

func NextDay(now time.Time, h, m, s int) time.Time

func NextHour

func NextHour(now time.Time, m, s int) time.Time

func NextWeekDay

func NextWeekDay(now time.Time, day WeekDay, h, m, s int) time.Time

func TickEventDef

func TickEventDef() *eventline.EventDef

Types

type Connector

type Connector struct {
	Def *eventline.ConnectorDef
	Cfg *ConnectorCfg
	Log *dlog.Logger
}

func NewConnector

func NewConnector() *Connector

func (*Connector) DefaultCfg

func (c *Connector) DefaultCfg() eventline.ConnectorCfg

func (*Connector) Definition

func (c *Connector) Definition() *eventline.ConnectorDef

func (*Connector) Init

func (*Connector) Name

func (c *Connector) Name() string

func (*Connector) Subscribe

func (c *Connector) Subscribe(conn pg.Conn, sctx *eventline.SubscriptionContext) error

func (*Connector) Terminate

func (c *Connector) Terminate()

func (*Connector) Unsubscribe

func (c *Connector) Unsubscribe(conn pg.Conn, sctx *eventline.SubscriptionContext) error

type ConnectorCfg

type ConnectorCfg struct {
	Secret string `json:"secret"`
}

func (*ConnectorCfg) Check

func (cfg *ConnectorCfg) Check(c *check.Checker)

type DailyParameters

type DailyParameters struct {
	Hour   int `json:"hour,omitempty"`
	Minute int `json:"minute,omitempty"`
	Second int `json:"second,omitempty"`
}

func (*DailyParameters) Check

func (p *DailyParameters) Check(c *check.Checker)

type HourlyParameters

type HourlyParameters struct {
	Minute int `json:"minute,omitempty"`
	Second int `json:"second,omitempty"`
}

func (*HourlyParameters) Check

func (p *HourlyParameters) Check(c *check.Checker)

type OneshotParameters

type OneshotParameters time.Time

type Parameters

type Parameters struct {
	Oneshot  *OneshotParameters `json:"oneshot,omitempty"`
	Periodic *int               `json:"periodic,omitempty"` // seconds
	Hourly   *HourlyParameters  `json:"hourly,omitempty"`
	Daily    *DailyParameters   `json:"daily,omitempty"`
	Weekly   *WeeklyParameters  `json:"weekly,omitempty"`
}

func (*Parameters) Check

func (p *Parameters) Check(c *check.Checker)

func (*Parameters) FirstTick

func (p *Parameters) FirstTick() (tick time.Time)

func (*Parameters) NextTick

func (p *Parameters) NextTick(expectedTick time.Time) (tick time.Time)

type Subscription

type Subscription struct {
	Id       eventline.Id
	LastTick *time.Time
	NextTick time.Time
}

func LoadSubscriptionForProcessing

func LoadSubscriptionForProcessing(conn pg.Conn) (*Subscription, *eventline.Subscription, error)

func (*Subscription) FromRow

func (s *Subscription) FromRow(row pgx.Row) error

func (*Subscription) Insert

func (s *Subscription) Insert(conn pg.Conn) error

func (*Subscription) Update

func (s *Subscription) Update(conn pg.Conn) error

type TickEvent

type TickEvent struct {
}

type WeekDay

type WeekDay string
const (
	WeekDayMonday    WeekDay = "monday"
	WeekDayTuesday   WeekDay = "tuesday"
	WeekDayWednesday WeekDay = "wednesday"
	WeekDayThursday  WeekDay = "thursday"
	WeekDayFriday    WeekDay = "friday"
	WeekDaySaturday  WeekDay = "saturday"
	WeekDaySunday    WeekDay = "sunday"
)

func (WeekDay) Number

func (wd WeekDay) Number() (n int)

type WeeklyParameters

type WeeklyParameters struct {
	Day    WeekDay `json:"day"`
	Hour   int     `json:"hour,omitempty"`
	Minute int     `json:"minute,omitempty"`
	Second int     `json:"second,omitempty"`
}

type Worker

type Worker struct {
	Log    *dlog.Logger
	Daemon *daemon.Daemon
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker() *Worker

func (*Worker) Init

func (w *Worker) Init(ew *eventline.Worker)

func (*Worker) ProcessJob

func (w *Worker) ProcessJob() (bool, error)

func (*Worker) Start

func (w *Worker) Start() error

func (*Worker) Stop

func (w *Worker) Stop()

Jump to

Keyboard shortcuts

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