Documentation
¶
Overview ¶
Package utilfx contains focused helpers for Fx dependency wiring.
Index ¶
- func Bind[Contract any, Impl any](impl Impl) (Contract, error)
- func GroupName(group, name string) string
- func GroupTag(group string) string
- func Grouped(group string, ctors ...any) fx.Option
- func GroupedAs[T any](group string, ctors ...any) fx.Option
- func GroupedFor(name, group string, ctors ...any) fx.Option
- func ModuleFor(name string, def fx.Option, mk func(string) fx.Option) fx.Option
- func NameTag(name string) string
- func OptionalNameTag(name string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bind ¶
Bind exposes implementation as contract. It can be passed directly to fx.Provide and replaces adapters of the form:
func(service *Service) Handler { return service }
An incompatible implementation is reported as an Fx constructor error.
func GroupName ¶
GroupName returns group when name is empty. Otherwise it returns a group name in the form "group:name".
func Grouped ¶
Grouped provides constructors whose results belong to the same Fx value group. Nil constructors are ignored.
func GroupedAs ¶
GroupedAs provides constructors as T in the same Fx value group. Each constructor result must implement T. Nil constructors are ignored.
func GroupedFor ¶
GroupedFor provides constructors in a group composed from group and name. Nil constructors are ignored.
func ModuleFor ¶
ModuleFor returns the default module when name is empty. Otherwise it builds the named module.
func OptionalNameTag ¶
OptionalNameTag returns an Fx tag for an optional named dependency.
Types ¶
This section is empty.