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
+35
View File
@@ -0,0 +1,35 @@
package book
import (
"github.com/eminetto/clean-architecture-go-v2/entity"
)
//Reader interface
type Reader interface {
Get(id entity.ID) (*entity.Book, error)
Search(query string) ([]*entity.Book, error)
List() ([]*entity.Book, error)
}
//Writer book writer
type Writer interface {
Create(e *entity.Book) (entity.ID, error)
Update(e *entity.Book) error
Delete(id entity.ID) error
}
//Repository interface
type Repository interface {
Reader
Writer
}
//UseCase interface
type UseCase interface {
GetBook(id entity.ID) (*entity.Book, error)
SearchBooks(query string) ([]*entity.Book, error)
ListBooks() ([]*entity.Book, error)
CreateBook(title string, author string, pages int, quantity int) (entity.ID, error)
UpdateBook(e *entity.Book) error
DeleteBook(id entity.ID) error
}