Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active August 29, 2021 06:29
Show Gist options
  • Save percybolmer/b00339780b7da16d79760518b94b3ff2 to your computer and use it in GitHub Desktop.
Save percybolmer/b00339780b7da16d79760518b94b3ff2 to your computer and use it in GitHub Desktop.
// 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