-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: invoke RegisterRoute instead of invoking NewRoute in module
refactor: change names of controller, service, route, module inside a domain
- Loading branch information
Showing
12 changed files
with
56 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package {{.PackageName}} | ||
|
||
type {{.ModuleName}}Model struct { | ||
type Model struct { | ||
Message string | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package {{.PackageName}} | ||
|
||
type {{.ModuleName}}Repository struct { | ||
type Repository struct { | ||
} | ||
|
||
func New{{.ModuleName}}Repository() *{{.ModuleName}}Repository { | ||
return &{{.ModuleName}}Repository{} | ||
func NewRepository() *Repository { | ||
return &Repository{} | ||
} | ||
|
||
func (s *{{.ModuleName}}Repository) GetMessage() {{.ModuleName}}Model { | ||
return {{.ModuleName}}Model{Message: "Hello World"} | ||
func (s *Repository) GetMessage() Model { | ||
return Model{Message: "Hello World"} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
package {{.PackageName}} | ||
|
||
// {{.ModuleName}}Service handles the business logic of the {{.ModuleName}} module | ||
type {{.ModuleName}}Service struct { | ||
// Service handles the business logic of the module | ||
type Service struct { | ||
// Add any dependencies here | ||
repo *{{.ModuleName}}Repository | ||
repo *Repository | ||
} | ||
|
||
// New{{.ModuleName}}Service creates a new instance of TestService | ||
func New{{.ModuleName}}Service(repo *{{.ModuleName}}Repository) *{{.ModuleName}}Service { | ||
return &{{.ModuleName}}Service{ | ||
// NewService creates a new instance of TestService | ||
func NewService(repo *Repository) *Service { | ||
return &Service{ | ||
repo: repo, | ||
} | ||
} | ||
|
||
// GetMessage returns a greeting message | ||
func (s *{{.ModuleName}}Service) GetMessage() {{.ModuleName}}Model { | ||
func (s *Service) GetMessage() Model { | ||
return s.repo.GetMessage() | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package hello | ||
|
||
type HelloModel struct { | ||
type Model struct { | ||
Message string | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package hello | ||
|
||
type HelloRepository struct { | ||
type Repository struct { | ||
} | ||
|
||
func NewHelloRepository() *HelloRepository { | ||
return &HelloRepository{} | ||
func NewRepository() *Repository { | ||
return &Repository{} | ||
} | ||
|
||
func (s *HelloRepository) GetMessage() HelloModel { | ||
return HelloModel{Message: "Hello World"} | ||
func (s *Repository) GetMessage() Model { | ||
return Model{Message: "Hello World"} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
package hello | ||
|
||
// HelloService handles the business logic of the Hello module | ||
type HelloService struct { | ||
// Service handles the business logic of the module | ||
type Service struct { | ||
// Add any dependencies here | ||
repo *HelloRepository | ||
repo *Repository | ||
} | ||
|
||
// NewHelloService creates a new instance of TestService | ||
func NewHelloService(repo *HelloRepository) *HelloService { | ||
return &HelloService{ | ||
// NewService creates a new instance of TestService | ||
func NewService(repo *Repository) *Service { | ||
return &Service{ | ||
repo: repo, | ||
} | ||
} | ||
|
||
// GetMessage returns a greeting message | ||
func (s *HelloService) GetMessage() HelloModel { | ||
func (s *Service) GetMessage() Model { | ||
return s.repo.GetMessage() | ||
} |