use beads sql store instead of opening our own

This commit is contained in:
Robin Olsen
2026-02-19 17:25:34 +01:00
parent 5794836864
commit 2e702e799d

View File

@@ -15,14 +15,6 @@ import (
"github.com/steveyegge/beads" "github.com/steveyegge/beads"
) )
type Config struct {
RootCmd string
WebAddress string
BeadsDBPath string
IssuePrefix string
StatisticsStoragePath string
}
type Services struct { type Services struct {
Config Config Config Config
DB *sql.DB DB *sql.DB
@@ -38,12 +30,6 @@ func NewServices(ctx context.Context, config Config) (*Services, func(), error)
os.Exit(0) os.Exit(0)
} }
db, err := sql.Open("sqlite3", config.BeadsDBPath)
if err != nil {
return nil, nil, err
}
cleanupFuncs = append(cleanupFuncs, func() { db.Close() })
store, err := beads.NewSQLiteStorage(ctx, config.BeadsDBPath) store, err := beads.NewSQLiteStorage(ctx, config.BeadsDBPath)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
@@ -67,7 +53,7 @@ func NewServices(ctx context.Context, config Config) (*Services, func(), error)
} }
return &Services{ return &Services{
DB: db, DB: beadsSvc.UnderlyingDB(),
Beads: beadsSvc, Beads: beadsSvc,
Statistics: statSvc, Statistics: statSvc,
Config: config, Config: config,
@@ -101,13 +87,3 @@ func initialized(beadsPath string) bool {
} }
return true return true
} }
func (s *Services) DeleteIssues() error {
var deleteIssues = "DELETE FROM issues;"
if _, err := s.DB.Exec(deleteIssues); err != nil {
return err
}
return nil
}