package database import ( "context" "errors" "github.com/gissleh/stufflog/database/postgres" "github.com/gissleh/stufflog/models" ) var ErrUnsupportedDriver = errors.New("usupported driver") type Database interface { Goals() models.GoalRepository Groups() models.GroupRepository Items() models.ItemRepository Logs() models.LogRepository Projects() models.ProjectRepository Tasks() models.TaskRepository ProjectGroups() models.ProjectGroupRepository } func Open(ctx context.Context, driver string, connect string) (Database, error) { switch driver { case "postgres": return postgres.Setup(ctx, connect) default: return nil, ErrUnsupportedDriver } }