function

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

fx/modules/bootstrap/function

fx module that runs a bootstrap/function handler through the adapter commands provided in the boostrap.function.adapters group (BSFunctionAdaptersGroupKey) — cloudevents HTTP, NATS, Pub/Sub, Kafka.

fxfact.NewApp(
	fx.Provide(func() function.Handler[*event.Event] { return handle }),
	cehttp.Module[*event.Event](),
	functionfx.Module[*event.Event](middlewares),
).Run()

T must be *event.Event or []*event.Event.

Lifecycle

  • OnStart — Function.Run runs in a goroutine, so fx.New returns and app.Run() listens for SIGINT/SIGTERM.
  • OnStop — the context passed to Run (and to the adapter command) is cancelled; the hook waits for Run to return, bounded by the stop context (fx's stop timeout), and returns the context error if it does not.
  • Run ends on its own (no stop requested) — the app is shut down with exit code 0 on success, or 1 when Run returned an error (logged).

Documentation

Index

Constants

View Source
const (
	BSFunctionAdaptersGroupKey = "boostrap.function.adapters"
)
View Source
const (
	Root = bootstrap.Root + ".function"
)

Variables

This section is empty.

Functions

func Module

func Module[T any](m []middleware.AnyErrorMiddleware[T]) fx.Option

Module fx module for bootstrap function. The function runs from the app's OnStart and its context is cancelled on OnStop, so app.Run handles SIGTERM gracefully; when the function ends on its own the app shuts down, with exit code 1 if it failed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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