You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
905 B
33 lines
905 B
package database
|
|
|
|
import (
|
|
"errors"
|
|
"git.aiterp.net/stufflog/server/database/drivers/mysqldriver"
|
|
"git.aiterp.net/stufflog/server/database/repositories"
|
|
)
|
|
|
|
var ErrDriverNotSupported = errors.New("driver not found or supported")
|
|
|
|
type Database interface {
|
|
Activities() repositories.ActivityRepository
|
|
Issues() repositories.IssueRepository
|
|
IssueTasks() repositories.IssueTaskRepository
|
|
IssueItems() repositories.IssueItemRepository
|
|
Items() repositories.ItemRepository
|
|
Projects() repositories.ProjectRepository
|
|
Session() repositories.SessionRepository
|
|
Users() repositories.UserRepository
|
|
ProjectStatuses() repositories.ProjectStatusRepository
|
|
Logs() repositories.LogRepository
|
|
// Migrate the database.
|
|
Migrate() error
|
|
}
|
|
|
|
func Open(driver, connect string) (Database, error) {
|
|
switch driver {
|
|
case "mysql":
|
|
return mysqldriver.Open(connect)
|
|
default:
|
|
return nil, ErrDriverNotSupported
|
|
}
|
|
}
|