app

package
v0.0.0-...-26e86c7 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoModuleRegistered = errors.New("couldn't find appropriate module")

Functions

func NewChanWaiter

func NewChanWaiter(channel chan error) *chanWaiter

func NewDirectWaiter

func NewDirectWaiter(initial error) *chanWaiter

func RegisterModule

func RegisterModule(name string, factory ModuleFactory)

Types

type App

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

func New

func New(name string, hooks ...Hook) *App

func (*App) Inject

func (a *App) Inject(vals ...interface{})

func (*App) Run

func (a *App) Run(ctx context.Context) error

type Hook

type Hook interface {
	api.Module
	Run(ctx context.Context) error
}

type HookModuleExt

type HookModuleExt interface {
	ModuleLoaded(ctx context.Context, m api.Module)
	ModuleInitialized(ctx context.Context, m api.Module)
}

type HookModuleInterceptor

type HookModuleInterceptor interface {
	Intercept(name string, module api.Module) bool
}

HookModuleInterceptor intercept loading of an module you can use this to selectively load/unload module based on hook e.g. selectively load modules by platform

type ModuleFactory

type ModuleFactory func() api.Module

type ModuleRegistry

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

func (*ModuleRegistry) Get

func (r *ModuleRegistry) Get(name string) (ModuleFactory, error)

func (*ModuleRegistry) IsRegistered

func (r *ModuleRegistry) IsRegistered(name string) bool

func (*ModuleRegistry) Load

func (r *ModuleRegistry) Load() []ModuleFactory

func (*ModuleRegistry) LoadMap

func (r *ModuleRegistry) LoadMap() map[string]ModuleFactory

func (*ModuleRegistry) Register

func (r *ModuleRegistry) Register(name string, factory ModuleFactory)

func (*ModuleRegistry) Unregister

func (r *ModuleRegistry) Unregister(name string)

type Waiter

type Waiter interface {
	Wait() <-chan error
}

type WebConfig

type WebConfig struct {
	Enabled      bool          `mapstructure:"enabled"`
	Address      string        `mapstructure:"address"`
	WriteTimeout time.Duration `mapstructure:"write_timeout"`
	ReadTimeout  time.Duration `mapstructure:"read_timeout"`
}

type WebHook

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

func NewWebHook

func NewWebHook() *WebHook

func (*WebHook) Close

func (h *WebHook) Close(ctx context.Context) error

func (*WebHook) Init

func (h *WebHook) Init(ctx context.Context, c config.Config) error

func (*WebHook) ModuleInitialized

func (h *WebHook) ModuleInitialized(ctx context.Context, m api.Module)

func (*WebHook) ModuleLoaded

func (h *WebHook) ModuleLoaded(ctx context.Context, m api.Module)

func (*WebHook) Run

func (h *WebHook) 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