feat: move entity and usecase to root folder

This commit is contained in:
Elton Minetto
2020-10-12 07:35:29 -03:00
parent 2c0f46aff1
commit 3e4eb2e616
33 changed files with 109 additions and 138 deletions
+3 -6
View File
@@ -3,8 +3,7 @@ package repository
import (
"strings"
"github.com/eminetto/clean-architecture-go-v2/domain"
"github.com/eminetto/clean-architecture-go-v2/domain/entity"
"github.com/eminetto/clean-architecture-go-v2/entity"
)
//BookInmem in memory repo
@@ -29,8 +28,7 @@ func (r *BookInmem) Create(e *entity.Book) (entity.ID, error) {
//Get a book
func (r *BookInmem) Get(id entity.ID) (*entity.Book, error) {
if r.m[id] == nil {
// return nil, fmt.Errorf("not found")
return nil, domain.ErrNotFound
return nil, entity.ErrNotFound
}
return r.m[id], nil
}
@@ -68,8 +66,7 @@ func (r *BookInmem) List() ([]*entity.Book, error) {
//Delete a book
func (r *BookInmem) Delete(id entity.ID) error {
if r.m[id] == nil {
// return fmt.Errorf("not found")
return domain.ErrNotFound
return entity.ErrNotFound
}
r.m[id] = nil
return nil