Skip to main content

Cron - Plugin operators

This page lists all operators available in the cron sub-package of ro.

Help improve this documentation

This documentation is still new and evolving. If you spot any mistakes, unclear explanations, or missing details, please open an issue.

Your feedback helps us improve!

Installโ€‹

First, import the sub-package in your project:

go get -u github.com/samber/ro/plugins/cron
  • Creates an observable that emits notifications on scheduler ticks.

    import (
    "github.com/go-co-op/gocron"

    "github.com/samber/ro"
    rocron "github.com/samber/ro/plugins/cron"
    )

    job := gocron.Every(1).Second()
    obs := rocron.NewScheduler(job)

    sub := obs.Subscribe(ro.PrintObserver[ScheduleJob]())
    defer sub.Unsubscribe()

    // Next: ScheduleJob{...}
    // Next: ScheduleJob{...}
    // ...
    Prototype:
    func NewScheduler(job gocron.JobDefinition)