Last active
August 29, 2021 06:29
-
-
Save percybolmer/b00339780b7da16d79760518b94b3ff2 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 Customer holds all the domain logic for the customer domain. | |
package customer | |
import ( | |
"github.com/google/uuid" | |
"github.com/percybolmer/ddd-go/aggregate" | |
) | |
var ( | |
// ErrCustomerNotFound is returned when a customer is not found. | |
ErrCustomerNotFound = errors.New("the customer was not found in the repository") | |
// ErrFailedToAddCustomer is returned when the customer could not be added to the repository. | |
ErrFailedToAddCustomer = errors.New("failed to add the customer to the repository") | |
// ErrUpdateCustomer is returned when the customer could not be updated in the repository. | |
ErrUpdateCustomer = errors.New("failed to update the customer in the repository") | |
) | |
// CustomerRepository is a interface that defines the rules around what a customer repository | |
// Has to be able to perform | |
type CustomerRepository interface { | |
Get(uuid.UUID) (aggregate.Customer, error) | |
Add(aggregate.Customer) error | |
Update(aggregate.Customer) error | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment