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.

33 lines
905 B

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