Documentation ¶
Index ¶
- type ByCompanyName
- type Customer
- type CustomerRepository
- func (cr CustomerRepository) AddCustomer(c Customer)
- func (cr CustomerRepository) DeleteCustomerByID(cid uuid.UUID) bool
- func (cr CustomerRepository) GetCustomerByID(cid uuid.UUID) (*Customer, bool)
- func (cr CustomerRepository) GetCustomersArray() []Customer
- func (cr CustomerRepository) PatchCustomer(cid uuid.UUID, c Customer) (*Customer, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByCompanyName ¶
type ByCompanyName []Customer
ByCompanyName is used for sorting customers by company name
func (ByCompanyName) Len ¶
func (c ByCompanyName) Len() int
func (ByCompanyName) Less ¶
func (c ByCompanyName) Less(i, j int) bool
func (ByCompanyName) Swap ¶
func (c ByCompanyName) Swap(i, j int)
type Customer ¶
type Customer struct { CustomerID uuid.UUID `json:"customerID,omitempty"` CompanyName string `json:"customerName"` ContactName string `json:"contactName"` Country string `json:"country"` HourlyRate decimal.Decimal `json:"hourlyRate"` }
Customer holds data of a customer record
type CustomerRepository ¶
type CustomerRepository struct {
// contains filtered or unexported fields
}
CustomerRepository is an in-memory repository of customers
func NewCustomerRepository ¶
func NewCustomerRepository() CustomerRepository
NewCustomerRepository creates a customer repository
func (CustomerRepository) AddCustomer ¶
func (cr CustomerRepository) AddCustomer(c Customer)
AddCustomer adds a customer to the repository
func (CustomerRepository) DeleteCustomerByID ¶
func (cr CustomerRepository) DeleteCustomerByID(cid uuid.UUID) bool
DeleteCustomerByID removes a customer with a given ID
func (CustomerRepository) GetCustomerByID ¶
func (cr CustomerRepository) GetCustomerByID(cid uuid.UUID) (*Customer, bool)
GetCustomerByID looks for a customer with a given ID
func (CustomerRepository) GetCustomersArray ¶
func (cr CustomerRepository) GetCustomersArray() []Customer
GetCustomersArray returns all stored customers as an array
func (CustomerRepository) PatchCustomer ¶
PatchCustomer patches a customer with the given values
Click to show internal directories.
Click to hide internal directories.