lifecycle

package
v2.0.0-beta4 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Option) *lifecycleWrapper

Types

type ContextErrorFunc

type ContextErrorFunc func(context.Context) error

type ContextFunc

type ContextFunc func(context.Context)

type Hook

type Hook struct {
	OnStart func(context.Context) error
	OnStop  func(context.Context) error
}

func StartHook

func StartHook[T HookFunc](start T) Hook

func StopHook

func StopHook[T HookFunc](stop T) Hook

type HookFunc

type HookFunc interface {
	~func(context.Context) | ~func(context.Context) error
}

type Lifecycle

type Lifecycle interface {
	Append(Hook)
}

type Option

type Option func(*lifecycleWrapper)

func WithTimeout

func WithTimeout(timeout time.Duration) Option

Jump to

Keyboard shortcuts

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