trigger

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: MIT Imports: 2 Imported by: 1

README

gapp-trigger

gapp

This library intent to provide a flexible and opinionated structure to build applications in a way that removes the problems of coding the same functionalities over and over regarding system components as configuration or logging.

Is the opinion of the library that the application scaffolding should revolve around the idea of a service container, seen in other types of frameworks. This container is responsible for storing factories of the application services that should be called for service instantiation, per need. This facilitates not only the composition of the application, but also directs the application architecture for a more dependency injection way of structuring services. By following this decoupled way of writing the application. will enable for more scalable and maintainable testing and production code.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func() error

Callback used as a trigger execution process.

type Trigger

type Trigger interface {
	Close()
	Timer() time.Duration
	IsStopped() bool
	Stop()
}

Trigger defines the interface of a trigger instance

func NewPulse

func NewPulse(delay time.Duration, callback Callback) (Trigger, error)

NewPulse instantiate a new pulse trigger that will execute a callback method after a determined amount of time.

func NewRecurring

func NewRecurring(period time.Duration, callback Callback) (Trigger, error)

NewRecurring instantiate a new trigger that will execute a callback method recurrently with a defined periodicity.

Jump to

Keyboard shortcuts

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