go-sarah: github.com/oklahomer/go-sarah/examples/simple/plugins/fixedtimer Index | Files

package fixedtimer

import "github.com/oklahomer/go-sarah/examples/simple/plugins/fixedtimer"

Package fixedtimer provides example code to setup ScheduledTaskProps with fixed schedule.

The configuration struct, timerConfig, does not implement ScheduledConfig interface, but instead fixed schedule is provided via ScheduledTaskPropsBuilder.Schedule. Schedule never changes no matter how many times the configuration file, fixed_timer.yaml, is updated.

Index

Package Files

props.go

Variables

var SlackProps = sarah.NewScheduledTaskPropsBuilder().
    BotType(slack.SLACK).
    Identifier("fixed_timer").
    ConfigurableFunc(&timerConfig{}, func(_ context.Context, config sarah.TaskConfig) ([]*sarah.ScheduledTaskResult, error) {
        return []*sarah.ScheduledTaskResult{
            {
                Content:     "Howdy!!",
                Destination: config.(*timerConfig).DefaultDestination(),
            },
        }, nil
    }).
    Schedule("@every 1m").
    MustBuild()

SlackProps is a pre-built fixed_timer task properties for Slack.

Package fixedtimer imports 4 packages (graph). Updated 2020-09-27. Refresh now. Tools for package owners.