commit b1f7b8ff682757c1be34999fd9c5cb7328083326 Author: a Date: Tue Mar 26 16:11:16 2024 -0500 boilr diff --git a/.config/boilr/templates/fx/project.json b/.config/boilr/templates/fx/project.json new file mode 100644 index 0000000..20e44e8 --- /dev/null +++ b/.config/boilr/templates/fx/project.json @@ -0,0 +1,5 @@ +{ + "Name": "fx", + "Description": "create an fx component", + "Package":"" +} diff --git a/.config/boilr/templates/fx/template/component.go b/.config/boilr/templates/fx/template/component.go new file mode 100644 index 0000000..4fcff7c --- /dev/null +++ b/.config/boilr/templates/fx/template/component.go @@ -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 +}