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

44 lines
613 B
Go
Raw Normal View History

2024-05-04 21:42:44 +00:00
{{- $pkg := env "PWD" | base | coalesce Package -}}
package {{$pkg}}
2024-03-26 21:11:16 +00:00
import (
2024-04-03 04:34:54 +00:00
"context"
2024-03-26 21:18:01 +00:00
"log/slog"
2024-03-26 21:11:16 +00:00
2024-03-26 21:18:01 +00:00
"go.uber.org/fx"
2024-04-12 19:03:58 +00:00
"gfx.cafe/util/go/fxplus"
2024-03-26 21:11:16 +00:00
)
2024-05-04 21:42:44 +00:00
type {{title $pkg}} struct {
2024-03-26 21:11:16 +00:00
log *slog.Logger
}
type Params struct {
2024-03-26 21:18:01 +00:00
fx.In
2024-03-26 21:11:16 +00:00
2024-05-04 21:42:44 +00:00
Ctx context.Context
Lc fx.Lifecycle
2024-03-26 21:11:16 +00:00
Log *slog.Logger
}
type Result struct {
2024-03-26 21:18:01 +00:00
fx.Out
2024-03-26 21:11:16 +00:00
2024-05-04 21:42:44 +00:00
Output *{{title $pkg}}
Healther fxplus.Healther `group:"fxplus"`
2024-03-26 21:11:16 +00:00
}
func New(p Params) (r Result, err error) {
2024-05-04 21:42:44 +00:00
o := &{{title $pkg}}{}
2024-03-26 21:11:16 +00:00
o.log = p.Log
2024-03-26 21:18:01 +00:00
2024-03-26 21:11:16 +00:00
r.Output = o
2024-04-12 19:03:58 +00:00
r.Healther = o
2024-03-26 21:11:16 +00:00
return
}
2024-04-03 04:34:54 +00:00
2024-05-04 21:42:44 +00:00
func (o *{{title $pkg}}) Health(ctx context.Context) (error) {
2024-04-12 19:03:58 +00:00
return nil
2024-04-03 04:34:54 +00:00
}