Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active September 4, 2021 17:41
Show Gist options
  • Save percybolmer/e68a769462f26aa2031e17ce6d6d12e0 to your computer and use it in GitHub Desktop.
Save percybolmer/e68a769462f26aa2031e17ce6d6d12e0 to your computer and use it in GitHub Desktop.
#ddd-tavern
// Package aggregates holds aggregates that combines many entities into a full object
package aggregate
import (
"github.com/percybolmer/ddd-go/entity"
"github.com/percybolmer/ddd-go/valueobject"
)
// Customer is a aggregate that combines all entities needed to represent a customer
type Customer struct {
// person is the root entity of a customer
// which means the person.ID is the main identifier for this aggregate
person *entity.Person
// a customer can hold many products
products []*entity.Item
// a customer can perform many transactions
transactions []valueobject.Transaction
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment