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.

31 lines
823 B

5 years ago
  1. package database
  2. import (
  3. "errors"
  4. "git.aiterp.net/stufflog/server/database/drivers/mysqldriver"
  5. "git.aiterp.net/stufflog/server/database/repositories"
  6. )
  7. var ErrDriverNotSupported = errors.New("driver not found or supported")
  8. type Database interface {
  9. Activities() repositories.ActivityRepository
  10. Issues() repositories.IssueRepository
  11. IssueTasks() repositories.IssueTaskRepository
  12. Items() repositories.ItemRepository
  13. Projects() repositories.ProjectRepository
  14. Session() repositories.SessionRepository
  15. Users() repositories.UserRepository
  16. ProjectStatuses() repositories.ProjectStatusRepository
  17. // Migrate the database.
  18. Migrate() error
  19. }
  20. func Open(driver, connect string) (Database, error) {
  21. switch driver {
  22. case "mysql":
  23. return mysqldriver.Open(connect)
  24. default:
  25. return nil, ErrDriverNotSupported
  26. }
  27. }