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

33 lines
366 B
Go
Raw Normal View History

2024-03-26 21:11:16 +00:00
package {{Package}}
import (
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
}