feat: move entity and usecase to root folder
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"database/sql"
|
||||
"time"
|
||||
|
||||
"github.com/eminetto/clean-architecture-go-v2/domain/entity"
|
||||
"github.com/eminetto/clean-architecture-go-v2/entity"
|
||||
)
|
||||
|
||||
//BookMySQL mysql repo
|
||||
|
||||
@@ -4,8 +4,7 @@ import (
|
||||
"fmt"
|
||||
"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"
|
||||
)
|
||||
|
||||
//UserInmem in memory repo
|
||||
@@ -30,8 +29,7 @@ func (r *UserInmem) Create(e *entity.User) (entity.ID, error) {
|
||||
//Get an user
|
||||
func (r *UserInmem) Get(id entity.ID) (*entity.User, 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
|
||||
}
|
||||
@@ -55,8 +53,7 @@ func (r *UserInmem) Search(query string) ([]*entity.User, error) {
|
||||
}
|
||||
}
|
||||
if len(d) == 0 {
|
||||
// return nil, fmt.Errorf("not found")
|
||||
return nil, domain.ErrNotFound
|
||||
return nil, entity.ErrNotFound
|
||||
}
|
||||
|
||||
return d, nil
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/eminetto/clean-architecture-go-v2/domain/entity"
|
||||
"github.com/eminetto/clean-architecture-go-v2/entity"
|
||||
)
|
||||
|
||||
//UserMySQL mysql repo
|
||||
|
||||
Reference in New Issue
Block a user