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

38 lines
472 B
Go
Raw Normal View History

2024-03-26 21:11:16 +00:00
package {{Package}}
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-03-26 21:11:16 +00:00
)
type {{title Package}} struct {
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-03-26 21:18:01 +00:00
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-03-26 21:18:01 +00:00
Output *{{title Package}}
2024-03-26 21:11:16 +00:00
}
func New(p Params) (r Result, err error) {
o := &{{title Package}}{}
o.log = p.Log
2024-03-26 21:18:01 +00:00
2024-03-26 21:11:16 +00:00
r.Output = o
return
}
2024-04-03 04:34:54 +00:00
func (o *{{title Package}}) Health(ctx context.Context) (bool, error) {
return true, nil
}