Use pointer receiver more offen
This commit is contained in:
parent
6999b4e728
commit
c7569b5e54
59 changed files with 688 additions and 672 deletions
|
@ -15,7 +15,7 @@ func init() {
|
|||
router.POST("/api/qa/:qid/comments", apiHandler(qaHandler(importQAComment)))
|
||||
}
|
||||
|
||||
func qaHandler(f func(fic.QAQuery, []byte) (interface{}, error)) func(httprouter.Params, []byte) (interface{}, error) {
|
||||
func qaHandler(f func(*fic.QAQuery, []byte) (interface{}, error)) func(httprouter.Params, []byte) (interface{}, error) {
|
||||
return func(ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
if qid, err := strconv.ParseInt(string(ps.ByName("qid")), 10, 64); err != nil {
|
||||
return nil, err
|
||||
|
@ -34,7 +34,7 @@ func importExerciceQA(_ httprouter.Params, body []byte) (interface{}, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
var exercice fic.Exercice
|
||||
var exercice *fic.Exercice
|
||||
var err error
|
||||
if uq.IdExercice == 0 {
|
||||
return nil, errors.New("id_exercice not filled")
|
||||
|
@ -62,7 +62,7 @@ func importExerciceQA(_ httprouter.Params, body []byte) (interface{}, error) {
|
|||
}
|
||||
}
|
||||
|
||||
func importQAComment(query fic.QAQuery, body []byte) (interface{}, error) {
|
||||
func importQAComment(query *fic.QAQuery, body []byte) (interface{}, error) {
|
||||
// Create a new query
|
||||
var uc fic.QAComment
|
||||
if err := json.Unmarshal(body, &uc); err != nil {
|
||||
|
|
Reference in a new issue