Skip to content

Instantly share code, notes, and snippets.

@krittawatcode
Last active November 20, 2020 18:05
Show Gist options
  • Save krittawatcode/9827c7eebe4b5828bc41abd846b3ec0d to your computer and use it in GitHub Desktop.
Save krittawatcode/9827c7eebe4b5828bc41abd846b3ec0d to your computer and use it in GitHub Desktop.
package controller
import (
"strconv"
"github.com/gin-gonic/gin"
"github.com/krittawatcode/go-soldier-mvc/service"
)
type SoldierController interface {
Eat(c *gin.Context)
}
type soldierController struct {
dutyService service.DutyService
}
func SoldierHandler(dutyService *service.DutyService) SoldierController {
return &soldierController{
dutyService: *dutyService,
}
}
func (s *soldierController) Eat(c *gin.Context) {
commission, _ := strconv.Atoi(c.Param("commission"))
s.dutyService.EatTax(c, commission)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment