Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCustomerDuplicate = errors.New("customer duplicate")
View Source
var ErrCustomerNotFound = errors.New("customer not found")
Functions ¶
Types ¶
type CustomerDTO ¶
type CustomerDTO struct { ID primitive.ObjectID `bson:"_id,omitempty"` Name string `bson:"name"` Email string `bson:"email"` Address string `bson:"address"` OrderHistory []primitive.ObjectID `bson:"order_history,omitempty"` }
func NewCustomerDTO ¶
func NewCustomerDTO(name string, email string, address string) *CustomerDTO
type CustomerRepository ¶
type CustomerRepository struct { Ctx context.Context Collection *mongo.Collection }
func NewCustomerRepository ¶
func NewCustomerRepository(ctx context.Context, DB *mongo.Database) *CustomerRepository
func (CustomerRepository) Create ¶
func (c CustomerRepository) Create(dto *CustomerDTO) (*CustomerDTO, error)
func (CustomerRepository) FindOne ¶
func (c CustomerRepository) FindOne(id primitive.ObjectID) (*CustomerDTO, error)
func (CustomerRepository) UpdateHistory ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.