From b1f7b8ff682757c1be34999fd9c5cb7328083326 Mon Sep 17 00:00:00 2001 From: a Date: Tue, 26 Mar 2024 16:11:16 -0500 Subject: [PATCH] boilr --- .config/boilr/templates/fx/project.json | 5 ++++ .../boilr/templates/fx/template/component.go | 30 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .config/boilr/templates/fx/project.json create mode 100644 .config/boilr/templates/fx/template/component.go 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 +}