refactor structure
This commit is contained in:
12
db/db.go
12
db/db.go
@@ -8,21 +8,17 @@ import (
|
||||
_ "github.com/glebarez/go-sqlite"
|
||||
)
|
||||
|
||||
type UserStore struct {
|
||||
type AppStore struct {
|
||||
Db *sql.DB
|
||||
}
|
||||
|
||||
func NewUserStore(dbName string) (UserStore, error) {
|
||||
func NewAppStore(dbName string) (AppStore, error) {
|
||||
Db, err := getConnection(dbName)
|
||||
if err != nil {
|
||||
return UserStore{}, err
|
||||
return AppStore{}, err
|
||||
}
|
||||
|
||||
if err := createMigrations(dbName, Db); err != nil {
|
||||
return UserStore{}, err
|
||||
}
|
||||
|
||||
return UserStore{
|
||||
return AppStore{
|
||||
Db,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user