This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package model | |
| import "time" | |
| type User struct { | |
| ID uint `gorm:"primary_key" json:"id"` | |
| Name string `json:"name"` | |
| Age string `json:"age"` | |
| CreatedAt time.Time `json:"created_at"` | |
| UpdatedAt time.Time `json:"updated_at"` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package interactor | |
| import ( | |
| "github.com/manakuro/golang-clean-architecture/domain/model" | |
| "github.com/manakuro/golang-clean-architecture/usecase/presenter" | |
| "github.com/manakuro/golang-clean-architecture/usecase/repository" | |
| ) | |
| type userInteractor struct { | |
| UserRepository repository.UserRepository |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package presenter | |
| import "github.com/manakuro/golang-clean-architecture/domain/model" | |
| type UserPresenter interface { | |
| ResponseUsers(u []*model.User) []*model.User | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package repository | |
| import "github.com/manakuro/golang-clean-architecture/domain/model" | |
| type UserRepository interface { | |
| FindAll(u []*model.User) ([]*model.User, error) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package controller | |
| import ( | |
| "net/http" | |
| "github.com/manakuro/golang-clean-architecture/domain/model" | |
| "github.com/manakuro/golang-clean-architecture/usecase/interactor" | |
| ) | |
| type userController struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package controller | |
| type AppController struct { | |
| User interface{ UserController } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package presenter | |
| import ( | |
| "golang-clean-architecture/domain/model" | |
| "golang-clean-architecture/usecase/presenter" | |
| ) | |
| type userPresenter struct{} | |
| func NewUserPresenter() presenter.UserPresenter { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package repository | |
| import ( | |
| "golang-clean-architecture/domain/model" | |
| "golang-clean-architecture/usecase/repository" | |
| "github.com/jinzhu/gorm" | |
| ) | |
| type userRepository struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package datastore | |
| import ( | |
| "log" | |
| "github.com/go-sql-driver/mysql" | |
| "github.com/jinzhu/gorm" | |
| "github.com/manakuro/golang-clean-architecture/config" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package router | |
| import ( | |
| "github.com/labstack/echo" | |
| "github.com/labstack/echo/middleware" | |
| "github.com/manakuro/golang-clean-architecture/interface/controller" | |
| ) | |
| func NewRouter(e *echo.Echo, c controller.AppController) *echo.Echo { | |
| e.Use(middleware.Logger()) |
OlderNewer