kelainan global chart

This commit is contained in:
Sas Andy
2024-04-30 17:16:21 +07:00
parent 3c9c63dd2a
commit d601cc0801
10 changed files with 898 additions and 316 deletions

View File

@@ -9,6 +9,9 @@ import (
type PieChartStore struct {
Db *sql.DB
}
type BarChartStore struct {
Db *sql.DB
}
func NewPieChartStore(dbName string) (PieChartStore, error) {
Db, err := getConnection(dbName)
@@ -24,3 +27,17 @@ func NewPieChartStore(dbName string) (PieChartStore, error) {
Db,
}, nil
}
func NewBarChartStore(dbName string) (BarChartStore, error) {
Db, err := getConnection(dbName)
if err != nil {
return BarChartStore{}, err
}
if err := createMigrations(dbName, Db); err != nil {
return BarChartStore{}, err
}
return BarChartStore{
Db,
}, nil
}