stufflog graphql server
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.
 
 
 

30 lines
776 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
Items() repositories.ItemRepository
Projects() repositories.ProjectRepository
Session() repositories.SessionRepository
Users() repositories.UserRepository
ProjectStatuses() repositories.ProjectStatusRepository
// Migrate the database.
Migrate() error
}
func Open(driver, connect string) (Database, error) {
switch driver {
case "mysql":
return mysqldriver.Open(connect)
default:
return nil, ErrDriverNotSupported
}
}