Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseService ¶
type BaseService struct {
ShutdownHandlers []ServiceLogicFunc
}
func (*BaseService) RegisterShutdownHandler ¶
func (s *BaseService) RegisterShutdownHandler(logic ServiceLogicFunc)
RegisterShutdownHandler adds a function to run during graceful shutdown
func (*BaseService) Run ¶
func (s *BaseService) Run(logic ServiceLogicFunc) error
Run executes the main service logic
func (*BaseService) RunWithContext ¶ added in v0.0.5
func (s *BaseService) RunWithContext(parentContext context.Context, logic ServiceLogicFunc) error
RunWithContext executes the main service logic with a parent context
type Service ¶ added in v1.0.0
type Service interface { // Run executes the main service logic Run(logic ServiceLogicFunc) error // RunWithContext executes the main service logic with a parent context RunWithContext(parentContext context.Context, logic ServiceLogicFunc) error // Shutdown executes shutdown functions and exits Shutdown(ctx context.Context) error // RegisterShutdownHandler adds a function to run during graceful shutdown RegisterShutdownHandler(logic ServiceLogicFunc) }
Service an interface to a base service
type ServiceLogicFunc ¶ added in v1.0.0
ServiceLogic a function for executing logic
Click to show internal directories.
Click to hide internal directories.