home/.config/boilr/templates/fx/template/component.go

44 lines
613 B
Go

{{- $pkg := env "PWD" | base | coalesce Package -}}
package {{$pkg}}
import (
"context"
"log/slog"
"go.uber.org/fx"
"gfx.cafe/util/go/fxplus"
)
type {{title $pkg}} struct {
log *slog.Logger
}
type Params struct {
fx.In
Ctx context.Context
Lc fx.Lifecycle
Log *slog.Logger
}
type Result struct {
fx.Out
Output *{{title $pkg}}
Healther fxplus.Healther `group:"fxplus"`
}
func New(p Params) (r Result, err error) {
o := &{{title $pkg}}{}
o.log = p.Log
r.Output = o
r.Healther = o
return
}
func (o *{{title $pkg}}) Health(ctx context.Context) (error) {
return nil
}