starto

package module
v0.0.0-...-d76bb01 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 14 Imported by: 0

README

starto

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(o *options)

Option is an application option.

func AfterStart

func AfterStart(fn func(context.Context) error) Option

AfterStart run functions after app starts.

func AfterStop

func AfterStop(fn func(context.Context) error) Option

AfterStop run functions after app stops.

func AppInfo

func AppInfo(opts ...app.Option) Option

AppInfo with service app info.

func BeforeStart

func BeforeStart(fn func(context.Context) error) Option

BeforeStart run functions before app starts.

func BeforeStop

func BeforeStop(fn func(context.Context) error) Option

BeforeStop run functions before app stops.

func Context

func Context(ctx context.Context) Option

Context with service context.

func FxOptions

func FxOptions(opts ...fx.Option) Option

FxOptions with fx modules.

func StartTimeout

func StartTimeout(t time.Duration) Option

StartTimeout with app start timeout.

func StopTimeout

func StopTimeout(t time.Duration) Option

StopTimeout with app stop timeout.

type StartoApp

type StartoApp[C any] struct {
	// contains filtered or unexported fields
}

StartoApp defines a application components lifecycle manager. [C] defines type of the configuration struct for the application.

func New

func New[C any](opts ...Option) *StartoApp[C]

func (*StartoApp[C]) AppInfo

func (a *StartoApp[C]) AppInfo() app.Info

func (*StartoApp[C]) Config

func (a *StartoApp[C]) Config() C

func (*StartoApp[C]) Logger

func (a *StartoApp[C]) Logger() *slog.Logger

func (*StartoApp[C]) Start

func (a *StartoApp[C]) Start() error

Start executes all OnStart hooks registered with the application's Lifecycle.

func (*StartoApp[C]) Stop

func (a *StartoApp[C]) Stop() error

Stop gracefully stops the application.

func (*StartoApp[C]) Wait

func (a *StartoApp[C]) Wait() (signal os.Signal, exitCode int)

Wait blocks application until termination.

Directories

Path Synopsis
modules

Jump to

Keyboard shortcuts

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