observer

package
v0.19.14 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntervalObserver

type IntervalObserver[T any] struct {
	Interval   time.Duration
	F          func(T) error
	Observable T
}

IntervalObserver defines a generic structure that observes a value at a fixed interval and executes a function on it. The observation continues until a stop signal is received from a shared channel or an error occurs in the function.

func (*IntervalObserver[T]) Observe

func (o *IntervalObserver[T]) Observe(stop <-chan any) error

Observe starts observing the Observable at regular intervals, executing the specified function until stopped or an error occurs. The observation loop terminates when the stop channel receives a signal or the function returns an error.

Jump to

Keyboard shortcuts

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