Documentation ¶
Index ¶
- Constants
- func GetInstance() *singleton
- type BikeBuilder
- type BuildProcess
- type BusBuilder
- type CarBuilder
- type CashPM
- type DebitCardPM
- type ItemInfoGetter
- type ManufacturingDirector
- type NewDebitCardPM
- type PaymentMethod
- type Shirt
- type ShirtCloner
- type ShirtColor
- type ShirtsCache
- type VehicleProduct
Constants ¶
View Source
const ( Cash = 1 DebitCard = 2 )
Our current implemented Payment methods are described here
View Source
const ( White = 1 Black = 2 Blue = 3 )
Variables ¶
This section is empty.
Functions ¶
func GetInstance ¶
func GetInstance() *singleton
Types ¶
type BikeBuilder ¶
type BikeBuilder struct {
// contains filtered or unexported fields
}
A Builder of type motorbike
func (*BikeBuilder) GetVehicle ¶
func (b *BikeBuilder) GetVehicle() VehicleProduct
func (*BikeBuilder) SetSeats ¶
func (b *BikeBuilder) SetSeats() BuildProcess
func (*BikeBuilder) SetStructure ¶
func (b *BikeBuilder) SetStructure() BuildProcess
func (*BikeBuilder) SetWheels ¶
func (b *BikeBuilder) SetWheels() BuildProcess
type BuildProcess ¶
type BuildProcess interface { SetWheels() BuildProcess SetSeats() BuildProcess SetStructure() BuildProcess GetVehicle() VehicleProduct }
type BusBuilder ¶
type BusBuilder struct {
// contains filtered or unexported fields
}
A Builder of type motorbike
func (*BusBuilder) GetVehicle ¶
func (b *BusBuilder) GetVehicle() VehicleProduct
func (*BusBuilder) SetSeats ¶
func (b *BusBuilder) SetSeats() BuildProcess
func (*BusBuilder) SetStructure ¶
func (b *BusBuilder) SetStructure() BuildProcess
func (*BusBuilder) SetWheels ¶
func (b *BusBuilder) SetWheels() BuildProcess
type CarBuilder ¶
type CarBuilder struct {
// contains filtered or unexported fields
}
A Builder of type car
func (*CarBuilder) GetVehicle ¶
func (c *CarBuilder) GetVehicle() VehicleProduct
func (*CarBuilder) SetSeats ¶
func (c *CarBuilder) SetSeats() BuildProcess
func (*CarBuilder) SetStructure ¶
func (c *CarBuilder) SetStructure() BuildProcess
func (*CarBuilder) SetWheels ¶
func (c *CarBuilder) SetWheels() BuildProcess
type DebitCardPM ¶
type DebitCardPM struct{}
func (*DebitCardPM) Pay ¶
func (c *DebitCardPM) Pay(amount float32) string
type ItemInfoGetter ¶
type ItemInfoGetter interface {
GetInfo() string
}
type ManufacturingDirector ¶
type ManufacturingDirector struct {
// contains filtered or unexported fields
}
Director
func (*ManufacturingDirector) Construct ¶
func (f *ManufacturingDirector) Construct()
func (*ManufacturingDirector) SetBuilder ¶
func (f *ManufacturingDirector) SetBuilder(b BuildProcess)
type NewDebitCardPM ¶
type NewDebitCardPM struct{}
func (*NewDebitCardPM) Pay ¶
func (d *NewDebitCardPM) Pay(amount float32) string
type PaymentMethod ¶
PaymentMethod defines a way of paying in the shop. This factory method returns objects that implements this interface
func GetPaymentMethod ¶
func GetPaymentMethod(m int) (PaymentMethod, error)
CreatePaymentMethod returns a pointer to a PaymentMethod object or an error if the method is not registered. We used "new" operator to return the pointer but we could also used &Type{} althought new makes it more readable for newcomers could be confusing
type Shirt ¶
type Shirt struct { Price float32 SKU string Color ShirtColor }
type ShirtCloner ¶
type ShirtCloner interface {
GetClone(m int) (ItemInfoGetter, error)
}
func GetShirtsCloner ¶
func GetShirtsCloner() ShirtCloner
type ShirtColor ¶
type ShirtColor byte
type ShirtsCache ¶
type ShirtsCache struct{}
func (*ShirtsCache) GetClone ¶
func (s *ShirtsCache) GetClone(m int) (ItemInfoGetter, error)
Click to show internal directories.
Click to hide internal directories.