Documentation ¶
Overview ¶
Package converter provides a framework for creating converters.
Index ¶
- Constants
- type Converter
- func (c *Converter[T]) GetCounterCreated() *expvar.Int
- func (c *Converter[T]) GetCounterDone() *expvar.Int
- func (c *Converter[T]) GetCounterFailed() *expvar.Int
- func (c *Converter[T]) GetCounterRunning() *expvar.Int
- func (c *Converter[T]) GetDescription() string
- func (c *Converter[T]) GetLogger() sypl.ISypl
- func (c *Converter[T]) GetName() string
- func (c *Converter[T]) GetOnFinished() OnFinished[T]
- func (c *Converter[T]) GetStatus() *expvar.String
- func (c *Converter[T]) GetType() string
- func (c *Converter[T]) SetOnFinished(onFinished OnFinished[T])
- type Func
- type IConverter
- type OnFinished
Constants ¶
const Type = "converter"
Type of the entity.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Converter ¶
type Converter[T any] struct { // Description of the processor. Description string `json:"description"` // Logger is the pipeline logger. Logger sypl.ISypl `json:"-" validate:"required"` // Name of the stage. Name string `json:"name" validate:"required"` // OnFinished is the function that is called when a processor finishes its // execution. OnFinished OnFinished[T] `json:"-"` // Metrics. CounterCreated *expvar.Int `json:"counterCreated" validate:"required,gte=0"` CounterRunning *expvar.Int `json:"counterRunning" validate:"required,gte=0"` CounterFailed *expvar.Int `json:"counterFailed" validate:"required,gte=0"` CounterDone *expvar.Int `json:"counterDone" validate:"required,gte=0"` Status *expvar.String `json:"status" validate:"required,gte=0"` }
Converter definition.
func (*Converter[T]) GetCounterCreated ¶
GetCounterCreated returns the `CounterCreated` of the processor.
func (*Converter[T]) GetCounterDone ¶
GetCounterDone returns the `CounterDone` of the processor.
func (*Converter[T]) GetCounterFailed ¶
GetCounterFailed returns the `CounterFailed` of the processor.
func (*Converter[T]) GetCounterRunning ¶
GetCounterRunning returns the `CounterRunning` of the processor.
func (*Converter[T]) GetDescription ¶
GetDescription returns the `Description` of the processor.
func (*Converter[T]) GetOnFinished ¶
func (c *Converter[T]) GetOnFinished() OnFinished[T]
GetOnFinished returns the `OnFinished` function.
func (*Converter[T]) SetOnFinished ¶
func (c *Converter[T]) SetOnFinished(onFinished OnFinished[T])
SetOnFinished sets the `OnFinished` function.
type Func ¶
type Func[T any] func(p IConverter[T]) IConverter[T]
Func allows to specify message's options.
func WithOnFinished ¶
func WithOnFinished[T any](onFinished OnFinished[T]) Func[T]
WithOnFinished sets the OnFinished function.
type IConverter ¶
type IConverter[T any] interface { shared.IMeta shared.IMetrics // GetOnFinished returns the `OnFinished` function. GetOnFinished() OnFinished[T] // SetOnFinished sets the `OnFinished` function. SetOnFinished(onFinished OnFinished[T]) // Run the converter function. Run(ctx context.Context, r io.Reader) (T, error) }
IConverter defines what a `Conveter` must do.
type OnFinished ¶
OnFinished is the function that is called when a processor finishes its execution.