Entferne Eigenschaft „active“
This commit is contained in:
parent
766aedf22d
commit
c7a9522c2c
2 changed files with 0 additions and 11 deletions
|
@ -10,5 +10,4 @@ type CourseRepository interface {
|
||||||
FindByName(name string) (Course, error)
|
FindByName(name string) (Course, error)
|
||||||
GetAll() ([]Course, error)
|
GetAll() ([]Course, error)
|
||||||
FindById(id int) (Course, error)
|
FindById(id int) (Course, error)
|
||||||
GetActive() ([]Course, error)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,16 +44,6 @@ func (r *CourseRepo) GetAll() ([]models.Course, error) {
|
||||||
return r.getFromRows(rows)
|
return r.getFromRows(rows)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *CourseRepo) GetActive() ([]models.Course, error) {
|
|
||||||
rows, err := r.db.Query("SELECT * FROM course WHERE active")
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer rows.Close()
|
|
||||||
|
|
||||||
return r.getFromRows(rows)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *CourseRepo) getFromRows(rows *sql.Rows) ([]models.Course, error) {
|
func (r *CourseRepo) getFromRows(rows *sql.Rows) ([]models.Course, error) {
|
||||||
var courses []models.Course
|
var courses []models.Course
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
|
|
Loading…
Reference in a new issue