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 main | |
| import "fmt" | |
| type Soldier struct { | |
| name string | |
| corrupt bool | |
| } | |
| func buggyLoop(soldiers []Soldier) { |
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 main | |
| import "fmt" | |
| // Soldier use for all case here | |
| type Soldier struct { | |
| name string | |
| corrupt bool | |
| } |
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 models | |
| // Todo ... | |
| type Todo struct { | |
| ID uint `json:"id"` | |
| Title string `json:"title"` | |
| Description string `json:"description"` | |
| } | |
| // TableName use to specific table |
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 domains | |
| import ( | |
| "github.com/krittawatcode/go-todo-clean-arch/models" | |
| ) | |
| // ToDoUseCase ... | |
| type ToDoUseCase interface { | |
| GetAllToDos() (t []models.Todo, err error) | |
| CreateATodo(t *models.Todo) (err 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 repositories | |
| import ( | |
| _ "github.com/go-sql-driver/mysql" // use to connect db | |
| "github.com/jinzhu/gorm" | |
| "github.com/krittawatcode/go-todo-clean-arch/domains" | |
| "github.com/krittawatcode/go-todo-clean-arch/models" | |
| ) | |
| type todoRepository 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 usecases | |
| import ( | |
| "github.com/krittawatcode/go-todo-clean-arch/domains" | |
| "github.com/krittawatcode/go-todo-clean-arch/models" | |
| ) | |
| // UseCase don't give a shit about the world!! | |
| type todoUseCase struct { | |
| todoRepo domains.ToDoRepository |
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 deliveries | |
| import ( | |
| "net/http" | |
| "github.com/gin-gonic/gin" | |
| "github.com/krittawatcode/go-todo-clean-arch/domains" | |
| "github.com/krittawatcode/go-todo-clean-arch/models" | |
| ) |
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 routes | |
| import ( | |
| "github.com/gin-gonic/gin" | |
| "github.com/krittawatcode/go-todo-clean-arch/databases" | |
| "github.com/krittawatcode/go-todo-clean-arch/deliveries" | |
| "github.com/krittawatcode/go-todo-clean-arch/repositories" | |
| "github.com/krittawatcode/go-todo-clean-arch/usecases" | |
| ) |
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 database | |
| import ( | |
| "fmt" | |
| "os" | |
| "github.com/jinzhu/gorm" | |
| ) | |
| // DB is a global var for connect DB |
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 main | |
| import ( | |
| "fmt" | |
| _ "github.com/go-sql-driver/mysql" | |
| "github.com/jinzhu/gorm" | |
| "github.com/krittawatcode/go-todo-clean-arch/databases" | |
| "github.com/krittawatcode/go-todo-clean-arch/deliveries/routes" | |
| "github.com/krittawatcode/go-todo-clean-arch/models" |