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 } }