Documentation

Overview

Package componenthelper assists with the creation of a new component.Component.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(options ...Option) component.Component

New returns a component.Component configured with the provided options.

Types

type Option

type Option func(*baseComponent)

Option represents the possible options for New.

func WithShutdown

func WithShutdown(shutdownFunc ShutdownFunc) Option

WithShutdown overrides the default `Shutdown` function for a component.Component. The default always returns nil.

func WithStart

func WithStart(startFunc StartFunc) Option

WithStart overrides the default `Start` function for a component.Component. The default always returns nil.

type ShutdownFunc

type ShutdownFunc func(context.Context) error

ShutdownFunc specifies the function invoked when the component.Component is being shutdown.

func (ShutdownFunc) Shutdown

func (f ShutdownFunc) Shutdown(ctx context.Context) error

Shutdown shuts down the component.

type StartFunc

type StartFunc func(context.Context, component.Host) error

StartFunc specifies the function invoked when the component.Component is being started.

func (StartFunc) Start

func (f StartFunc) Start(ctx context.Context, host component.Host) error

Start starts the component.