Use pointer receiver more offen
This commit is contained in:
parent
6999b4e728
commit
c7569b5e54
59 changed files with 688 additions and 672 deletions
|
@ -14,7 +14,7 @@ func init() {
|
|||
router.GET("/api/exercices/:eid", apiHandler(exerciceHandler(showExercice)))
|
||||
}
|
||||
|
||||
func exerciceHandler(f func(QAUser, fic.Exercice, []byte) (interface{}, error)) func(QAUser, httprouter.Params, []byte) (interface{}, error) {
|
||||
func exerciceHandler(f func(QAUser, *fic.Exercice, []byte) (interface{}, error)) func(QAUser, httprouter.Params, []byte) (interface{}, error) {
|
||||
return func(u QAUser, ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
if eid, err := strconv.ParseInt(string(ps.ByName("eid")), 10, 64); err != nil {
|
||||
return nil, err
|
||||
|
@ -31,6 +31,6 @@ func listExercices(_ QAUser, _ httprouter.Params, body []byte) (interface{}, err
|
|||
return fic.GetExercices()
|
||||
}
|
||||
|
||||
func showExercice(_ QAUser, exercice fic.Exercice, body []byte) (interface{}, error) {
|
||||
func showExercice(_ QAUser, exercice *fic.Exercice, body []byte) (interface{}, error) {
|
||||
return exercice, nil
|
||||
}
|
||||
|
|
Reference in a new issue