diff --git a/internal/version.go b/internal/version.go index 50f2efa..d136b28 100644 --- a/internal/version.go +++ b/internal/version.go @@ -7,7 +7,7 @@ import ( "strings" ) -const Version = "v0.5.2" +const Version = "v0.5.3" func ValidateLatestVersion() { cmd := exec.Command("go", "list", "-m", "github.com/renanbastos93/boneless@latest") diff --git a/templates/files/component.go.tpl b/templates/files/component.go.tpl index 02d74ff..c85bdab 100644 --- a/templates/files/component.go.tpl +++ b/templates/files/component.go.tpl @@ -30,7 +30,8 @@ type Config struct { type implapp struct { weaver.Implements[Component] weaver.WithConfig[Config] - db *store.Queries + dbConn *sql.DB + db *store.Queries } func (e *implapp) Init(ctx context.Context) error { @@ -44,10 +45,17 @@ func (e *implapp) Init(ctx context.Context) error { return fmt.Errorf("failed to ping: %w", err) } + e.dbConn = db e.db = store.New(db) return nil } + +func (e *implapp) Shutdown(ctx context.Context) error { + // TODO: create your logic to shutdown the component + return e.dbConn.Close() +} + func (e implapp) AllExamples(ctx context.Context) (out AllExamplesOut, err error) { examples, err := e.db.ListExamples(ctx) if err != nil {