func getCoursesFromDepartment(db *sql.DB, d common.Department) (responseCourses, error) {
	query := `SELECT c.code, c.name, c.credits FROM courses c, departments d
				WHERE c.department=$1 AND d.id=c.department`
	rows, err := db.Query(query, d.ID)
	if err != nil {
		return nil, err
	}
	courses := responseCourses{}
	for rows.Next() {
		var newCourse responseCourse
		err = rows.Scan(&newCourse.Code, &newCourse.Name, &newCourse.Credits)
		if err != nil {
			log.Printf("Error while scanning department courses: %v, err: %v\n", d.Code, err)
		}
		courses = append(courses, newCourse)
	}
	return courses, nil
}
GetCoursesFromDepartment returns all the courses offered by a given department.
package course
import (
	"database/sql"
	"log"
	"github.com/kshitij10496/hercules/common"
)
type responseCourse struct {
	Code       string             `json:"code"`
	Name       string             `json:"name"`
	Credits    int                `json:"credits"`
	Department *common.Department `json:"department,omitempty"`
	Faculty    *common.Faculty    `json:"faculty,omitempty"`
	Slots      *common.Slots      `json:"slots,omitempty"`
	Rooms      *common.Rooms      `json:"rooms,omitempty"`
}
type responseCourses []responseCourse