creational

package
v0.0.0-...-411beef Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoScaler

type AutoScaler struct {
	Spec   *AutoScalerSpec
	Status *AutoScalerStatus

	Mode CopyMode
}

func DeepCopyWithSerialization

func DeepCopyWithSerialization(a *AutoScaler) AutoScaler

func NewAutoScaler

func NewAutoScaler(min, max int, target float32) *AutoScaler

func (*AutoScaler) UpdateStatus

func (a *AutoScaler) UpdateStatus() AutoScaler

type AutoScalerSpec

type AutoScalerSpec struct {
	Min    *int
	Max    *int
	Target *float32
}

type AutoScalerStatus

type AutoScalerStatus struct {
	Current   int
	Desired   int
	Available int
}

type CopyMode

type CopyMode int
const (
	Serialization CopyMode = iota
	Function
)

type Director

type Director struct {
	// contains filtered or unexported fields
}

Director encapsulates the robot builder and builds the robot by the correct maker based on the currently set builder. This decouples the inner creation logics and functions from the client.

func NewDirector

func NewDirector(m RobotMaker) *Director

func (*Director) Build

func (d *Director) Build() Robot

func (*Director) SetRobotMaker

func (d *Director) SetRobotMaker(m RobotMaker)

type Employee

type Employee struct {
	Name    string
	Company string
	Address string
}

type EmployeeBuilder

type EmployeeBuilder struct {
	// contains filtered or unexported fields
}

func NewEmployeeBuilder

func NewEmployeeBuilder() *EmployeeBuilder

func (*EmployeeBuilder) Build

func (c *EmployeeBuilder) Build() Employee

func (*EmployeeBuilder) WithAddress

func (c *EmployeeBuilder) WithAddress(address string) *EmployeeBuilder

func (*EmployeeBuilder) WithCompany

func (c *EmployeeBuilder) WithCompany(company string) *EmployeeBuilder

func (*EmployeeBuilder) WithName

func (c *EmployeeBuilder) WithName(name string) *EmployeeBuilder

type Parking

type Parking interface {
	ParkVehicle()
	UnParkVehicle()
	DisplayFreeSlots()
}

func NewParking

func NewParking(parkType ParkingType, store Repository) Parking

NewParking is the factory method that makes store be passed as an external dependency which can be mocked. It is the single function that would be used by all clients for creating all kinds of parking: onstreet, mall, etc..

type ParkingType

type ParkingType int
const (
	Street ParkingType = iota
	Mall
)

type Repository

type Repository interface {
	Create()
	Update()
}

Repository is the external dependency of Parking

type Robot

type Robot struct {
	// contains filtered or unexported fields
}

Robot Component: Product

type RobotBuilder

type RobotBuilder interface {
	BuildRobotHead()
	BuildRobotTorso()
	BuildRobotLegs()
	BuildRobotArms()

	Build() Robot
}

RobotBuilder defines what the robot has Component: BuilderInterface

func NewRobotBuilder

func NewRobotBuilder(robotMaker RobotMaker) RobotBuilder

type RobotMaker

type RobotMaker int
const (
	Apple RobotMaker = iota
	Tesla
)

type ScrollBar

type ScrollBar interface {
	Scroll()
}

ScrollBar is an interface to specify what a scrollbar could be

type Window

type Window interface {
	Open()
}

Window is an interface to specify what a scrollbar could be

type WindowKitFactory

type WindowKitFactory interface {
	// CreateScrollBar does the work and creates a ScrollBar
	CreateScrollBar() ScrollBar
	// CreateWindow does the work and creates a Window
	CreateWindow() Window
}

WindowKitFactory is an abstract factory interface for creating user interface toolkit, it prevents the clients from commiting to a implementation of the interface.

func NewMotifFactory

func NewMotifFactory() WindowKitFactory

NewMotifFactory creates the factory for creating Motif type of WindowKit

func NewOpenLookFactory

func NewOpenLookFactory() WindowKitFactory

NewOpenLookFactory creates the factory for creating OpenLook type of WindowKit

func NewWindowKitFactory

func NewWindowKitFactory(t WindowKitType) (WindowKitFactory, error)

NewWindowKitFactory creates the factory for the specified WindowKit, using that WindowKit factory we can create the window kit.

type WindowKitType

type WindowKitType int
const (
	MotifType WindowKitType = iota
	OpenLookType
)

Jump to

Keyboard shortcuts

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