Documentation
¶
Index ¶
- Constants
- type Factory
- func (f *Factory[PRODUCT]) AddLineOfFuncs(name string) *Line[PRODUCT]
- func (f *Factory[PRODUCT]) AddLineOfObjects(name string) *Line[PRODUCT]
- func (f *Factory[PRODUCT]) Line(name string) (line *Line[PRODUCT])
- func (f *Factory[PRODUCT]) ProcessFull(pprec *ProductProgressRecord[PRODUCT])
- func (f *Factory[PRODUCT]) ProcessOneLine(pprec *ProductProgressRecord[PRODUCT])
- type IStation
- type Line
- type ProductProgressRecord
- type StationFunc
Constants ¶
const ( LineType_Undef = iota LineType_Object LineType_Func )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory[PRODUCT any] struct { Hook_PreLine func(pprec *ProductProgressRecord[PRODUCT]) Hook_AfterLine func(pprec *ProductProgressRecord[PRODUCT]) Hook_PreStation func(pprec *ProductProgressRecord[PRODUCT]) Hook_AfterStation func(pprec *ProductProgressRecord[PRODUCT]) // contains filtered or unexported fields }
This has absolutely nothing to do with the bullshit "factory pattern" popularized by the book "Design Patterns: Elements of Reusable Object-Oriented Software", by Gamma, Erich; Helm, Richard; Johnson, Ralph; Vlissides, John (1995), Addison-Wesley, ISBN 0-201-63361-2. Nor is it the https://www.google.com/search?q=oop+factory+pattern. It has nothing to do with Gang of Four, or Gang of Five, or any other Gang of Bullshit. Instead, it specifically implements this: https://www.google.com/search?q=factory+production+line&udm=2 https://en.wikipedia.org/wiki/Production_line https://en.wikipedia.org/wiki/Assembly_line The Factory is thread-safe for operation, but thread-unsafe for modification.
func NewFactory ¶
func (*Factory[PRODUCT]) AddLineOfFuncs ¶
func (*Factory[PRODUCT]) AddLineOfObjects ¶
func (*Factory[PRODUCT]) ProcessFull ¶
func (f *Factory[PRODUCT]) ProcessFull(pprec *ProductProgressRecord[PRODUCT])
func (*Factory[PRODUCT]) ProcessOneLine ¶
func (f *Factory[PRODUCT]) ProcessOneLine(pprec *ProductProgressRecord[PRODUCT])
To be used in a user-code managed loop, e.g. when each per-line progress gets persistized. Alternatively, consider using ProcessFull().
type IStation ¶
type IStation[PRODUCT any] interface { Do(*ProductProgressRecord[PRODUCT]) }
type Line ¶
type Line[PRODUCT any] struct { // contains filtered or unexported fields }
func (*Line[PRODUCT]) AddStationAsFunc ¶
func (line *Line[PRODUCT]) AddStationAsFunc(s StationFunc[PRODUCT]) *Line[PRODUCT]
func (*Line[PRODUCT]) AddStationAsObject ¶
type ProductProgressRecord ¶
type ProductProgressRecord[PRODUCT any] struct { Product PRODUCT CurrentPosition struct { Line string Station int } FullStopNow bool JumpToLine string }
See https://en.wikipedia.org/wiki/Medical_record
func NewProductProgressRecord ¶
func NewProductProgressRecord[PRODUCT any](product PRODUCT, lineName string) *ProductProgressRecord[PRODUCT]
type StationFunc ¶
type StationFunc[PRODUCT any] func(*ProductProgressRecord[PRODUCT])
func (StationFunc[PRODUCT]) Do ¶
func (sf StationFunc[PRODUCT]) Do(pr *ProductProgressRecord[PRODUCT])