appRunner

package
v0.0.0-...-355cc10 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RegisterSet = wire.NewSet(
	wire.Bind(new(Register), new(Handler)),
	New,
)

Functions

func BeforeWrapper

func BeforeWrapper(beforeRun func(context.Context) error) *runBeforeWrapper

func DiScope

func DiScope() *s.XScope

func DiScopeNamed

func DiScopeNamed(appName string) *s.XScope

func RunAfter

func RunAfter(runners ...interface{}) (err error)

func RunBefore

func RunBefore(ctx context.Context, cancel context.CancelFunc, runners ...interface{}) error

func RunWrapper

func RunWrapper(run func(context.Context) error) *runWrapper

func Runner

func Runner(ctx context.Context, log *slog.Logger, cancel context.CancelFunc, runners ...interface{}) error

func Wrapper

func Wrapper(beforeRun func(context.Context) error, run func(context.Context) error) *wrapper

Types

type After

type After interface {
	After() error
}

type AfterDecorator

type AfterDecorator func() error

func (AfterDecorator) After

func (d AfterDecorator) After() error

type Before

type Before interface {
	Before(context.Context) error
}

type BeforeDecorator

type BeforeDecorator func(context.Context) error

func (BeforeDecorator) Before

func (d BeforeDecorator) Before(ctx context.Context) error

type DummyRegister

type DummyRegister struct {
	// contains filtered or unexported fields
}

func NewDummyRegister

func NewDummyRegister() *DummyRegister

func (*DummyRegister) Add

func (d *DummyRegister) Add(a interface{})

func (*DummyRegister) RunAfter

func (d *DummyRegister) RunAfter() error

func (*DummyRegister) RunBefore

func (d *DummyRegister) RunBefore(ctx context.Context) error

type Executor

type Executor struct {
	BeforeDecorator
	RunDecorator
	AfterDecorator
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func New

func New(log *slog.Logger) *Handler

func (*Handler) Add

func (s *Handler) Add(item interface{})

func (Handler) Run

func (s Handler) Run(ctx context.Context, cancel context.CancelFunc) error

func (Handler) RunAfter

func (s Handler) RunAfter() error

func (Handler) RunBefore

func (s Handler) RunBefore(ctx context.Context, cancel context.CancelFunc) error

func (Handler) RunFunc

func (s Handler) RunFunc(
	ctx context.Context,
	cancel context.CancelFunc,
	runFunc func() error,
) (returnErr error)

func (*Handler) RunOnce

func (s *Handler) RunOnce(
	ctx context.Context,
	cancel context.CancelFunc,
	runFunc func() error,
) error

func (*Handler) RunOnceWithContext

func (s *Handler) RunOnceWithContext(
	ctx context.Context,
	cancel context.CancelFunc,
	runFunc func(context.Context) error,
) error

func (*Handler) RunWithSigTerm

func (s *Handler) RunWithSigTerm(ctx context.Context, cancel context.CancelFunc) error

func (*Handler) Running

func (s *Handler) Running() chan struct{}

type NoopRegister

type NoopRegister struct {
}

func (NoopRegister) Add

func (n NoopRegister) Add(interface{})

type Register

type Register interface {
	Add(interface{})
}

func DiBind

func DiBind(i *Handler) Register

type Run

type Run interface {
	Run(context.Context) error
}

type RunDecorator

type RunDecorator func(context.Context, chan error)

func (RunDecorator) Run

func (d RunDecorator) Run(ctx context.Context, done chan error)

type RunnerHandler

type RunnerHandler func(ctx context.Context) error

func (RunnerHandler) Run

func (h RunnerHandler) Run(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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