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

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. Items() repositories.ItemRepository
  12. Projects() repositories.ProjectRepository
  13. Session() repositories.SessionRepository
  14. Users() repositories.UserRepository
  15. ProjectStatuses() repositories.ProjectStatusRepository
  16. // Migrate the database.
  17. Migrate() error
  18. }
  19. func Open(driver, connect string) (Database, error) {
  20. switch driver {
  21. case "mysql":
  22. return mysqldriver.Open(connect)
  23. default:
  24. return nil, ErrDriverNotSupported
  25. }
  26. }