lazyservice

package module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: BSD-3-Clause Imports: 10 Imported by: 2

Documentation

Overview

Package lazyservice provides a framework for building lazy applications in Go. A lazy application is an application that starts and stops services on demand. It allows you to define services as functions and run them within the application. The lazyapp package provides an interface for defining services, adding values and types to the application, and running the application and its services. It also provides a default logger implementation and supports colored debug messages and JSON logs. The application uses trace regions for the app and each of the services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	lazycontext.AppContext
	AddService(Service)
	Run() error
}

func New

func New() Manager

New creates a new app setting the name and version of the app. If the name is empty, it tries to use the base name of the executable. If the version is empty, it tries to use the modification time of the executable.

func NewWithContext

func NewWithContext(ctx context.Context) Manager

NewWithContext creates a new app setting the name and version of the app and the context.

type Service

type Service interface {
	Desc() ServiceDescription
	Run(context.Context) error
}

type ServiceDescription

type ServiceDescription interface {
	Name() string
}

Jump to

Keyboard shortcuts

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