Created
August 30, 2021 06:28
-
-
Save percybolmer/c636f33d69722ee64382e4eabb8dd143 to your computer and use it in GitHub Desktop.
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 product holds the repository and the implementations for a ProductRepository | |
package product | |
import ( | |
"errors" | |
"github.com/google/uuid" | |
"github.com/percybolmer/ddd-go/aggregate" | |
) | |
var ( | |
//ErrProductNotFound is returned when a product is not found | |
ErrProductNotFound = errors.New("the product was not found") | |
//ErrProductAlreadyExist is returned when trying to add a product that already exists | |
ErrProductAlreadyExist = errors.New("the product already exists") | |
) | |
// ProductRepository is the repository interface to fulfill to use the product aggregate | |
type ProductRepository interface { | |
GetAll() ([]aggregate.Product, error) | |
GetByID(id uuid.UUID) (aggregate.Product, error) | |
Add(product aggregate.Product) error | |
Update(product aggregate.Product) error | |
Delete(id uuid.UUID) error | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment