100-go-mistakes/02-code-project-organization/5-interface-pollution/decoupling/with.go
2021-12-27 15:57:20 +01:00

14 lines
275 B
Go

package main
type customerStorer interface {
StoreCustomer(Customer) error
}
type CustomerService2 struct {
storer customerStorer
}
func (cs CustomerService2) CreateNewCustomer(id string) error {
customer := Customer{id: id}
return cs.storer.StoreCustomer(customer)
}