Skip to content

Instantly share code, notes, and snippets.

@manakuro
Created November 7, 2019 02:34
Show Gist options
  • Save manakuro/f0b07ac7bee0d911502b0b2090ed46ab to your computer and use it in GitHub Desktop.
Save manakuro/f0b07ac7bee0d911502b0b2090ed46ab to your computer and use it in GitHub Desktop.
package controller
import (
"net/http"
"github.com/manakuro/golang-clean-architecture/domain/model"
"github.com/manakuro/golang-clean-architecture/usecase/interactor"
)
type userController struct {
userInteractor interactor.UserInteractor
}
type UserController interface {
GetUsers(c Context) error
}
func NewUserController(us interactor.UserInteractor) UserController {
return &userController{us}
}
func (uc *userController) GetUsers(c Context) error {
var u []*model.User
u, err := uc.userInteractor.Get(u)
if err != nil {
return err
}
return c.JSON(http.StatusOK, u)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment