boilr
This commit is contained in:
commit
b1f7b8ff68
5
.config/boilr/templates/fx/project.json
Normal file
5
.config/boilr/templates/fx/project.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"Name": "fx",
|
||||
"Description": "create an fx component",
|
||||
"Package":""
|
||||
}
|
30
.config/boilr/templates/fx/template/component.go
Normal file
30
.config/boilr/templates/fx/template/component.go
Normal file
@ -0,0 +1,30 @@
|
||||
package {{Package}}
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
|
||||
"go.uber.org/fx"
|
||||
)
|
||||
|
||||
type {{title Package}} struct {
|
||||
log *slog.Logger
|
||||
}
|
||||
|
||||
type Params struct {
|
||||
fx.In
|
||||
|
||||
Log *slog.Logger
|
||||
}
|
||||
|
||||
type Result struct {
|
||||
fx.Out
|
||||
|
||||
Output *{{title Package}}
|
||||
}
|
||||
|
||||
func New(p Params) (r Result, err error) {
|
||||
o := &{{title Package}}{}
|
||||
o.log = p.Log
|
||||
r.Output = o
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue
Block a user