customer_infrastructure

package
v0.0.0-...-52e64fa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 7 Imported by: 0

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

func GetName

func GetName() string

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 (CustomerRepository) UpdateHistory

func (c CustomerRepository) UpdateHistory(ID primitive.ObjectID, orderID primitive.ObjectID) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL