Documentation ¶
Overview ¶
Package runner provides a Runner type that is used to define both RunCounter and EmbeddedRunCounter to show examples of how to use composition in Go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RunCounter ¶
type RunCounter struct {
// contains filtered or unexported fields
}
A RunCounter is a Runner that keeps a counter of the run tasks.
func NewRunCounter ¶
func NewRunCounter(name string) *RunCounter
func (*RunCounter) Count ¶
func (r *RunCounter) Count() int
func (*RunCounter) Name ¶
func (r *RunCounter) Name() string
func (*RunCounter) Run ¶
func (r *RunCounter) Run(t Task)
func (*RunCounter) RunAll ¶
func (r *RunCounter) RunAll(ts []Task)
type RunCounter2 ¶
type RunCounter2 struct { Runner // HL // contains filtered or unexported fields }
RunCounter2 is completely equivalent to RunCounter, but uses struct embedding to avoid the boilerplate of redeclaring the Name method.
func NewRunCounter2 ¶
func NewRunCounter2(name string) *RunCounter2
func (*RunCounter2) Count ¶
func (r *RunCounter2) Count() int
func (*RunCounter2) Run ¶
func (r *RunCounter2) Run(t Task)
func (*RunCounter2) RunAll ¶
func (r *RunCounter2) RunAll(ts []Task)
Click to show internal directories.
Click to hide internal directories.