humus

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2025 License: MIT Imports: 28 Imported by: 1

README

humus

Go Reference Go Report Card Coverage build

humus one stop shop framework for all Z5Labs projects in Go.

Documentation

Overview

Package humus provides a base config and abstraction for running apps.

Index

Constants

This section is empty.

Variables

View Source
var ErrOTLPMustBeEnabled = errors.New("missing otlp client conn")

Functions

func DefaultConfig added in v0.4.0

func DefaultConfig() bedrockcfg.Source

DefaultConfig

func Logger

func Logger(name string) *slog.Logger

Logger

Types

type Config

type Config struct {
	OTel config.OTel `config:"otel"`
}

Config

func (Config) InitializeOTel added in v0.5.0

func (cfg Config) InitializeOTel(ctx context.Context) error

InitializeOTel implements the [appbuilder.OTelInitializer] interface.

type ErrorHandler added in v0.5.0

type ErrorHandler interface {
	HandleError(error)
}

ErrorHandler allows custom error handling logic to be defined for when the Runner encounters an error while building or running a bedrock.App.

type ErrorHandlerFunc added in v0.5.0

type ErrorHandlerFunc func(error)

ErrorHandlerFunc is a func type of the ErrorHandler interface.

func (ErrorHandlerFunc) HandleError added in v0.5.0

func (f ErrorHandlerFunc) HandleError(err error)

HandleError implements the ErrorHandler inteface.

type Runner added in v0.5.0

type Runner[T any] struct {
	// contains filtered or unexported fields
}

Runner orchestrates the building of a bedrock.App and running it.

func NewRunner added in v0.5.0

func NewRunner[T any](builder bedrock.AppBuilder[T], opts ...RunnerOption) Runner[T]

NewRunner initializes a Runner.

func (Runner[T]) Run added in v0.5.0

func (r Runner[T]) Run(ctx context.Context, cfg T)

Run builds a bedrock.App, runs it, and handles any error returned from either of those steps.

type RunnerOption added in v0.5.0

type RunnerOption interface {
	ApplyRunnerOption(*RunnerOptions)
}

RunnerOption sets a value on RunnerOptions.

func OnError added in v0.5.0

func OnError(eh ErrorHandler) RunnerOption

OnError registers the given ErrorHandler with the Runner.

type RunnerOptions added in v0.5.0

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

RunnerOptions are configurable parameters of a Runner.

Directories

Path Synopsis
example
Package health provides utilities for monitoring the healthiness of an application.
Package health provides utilities for monitoring the healthiness of an application.
Package humuspb defines reusable protobuf types for use in APIs.
Package humuspb defines reusable protobuf types for use in APIs.
ptr
try
Package rest supports creating RESTful applications.
Package rest supports creating RESTful applications.
rpc
Package rpc helps users implement [http.Handler]s using a RPC style interface.
Package rpc helps users implement [http.Handler]s using a RPC style interface.

Jump to

Keyboard shortcuts

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