Documentation
¶
Index ¶
- Variables
- func DefaultSchemaValidator(ctx context.Context, driver *toolkit.Driver, properties *TransformerProperties, ...) (toolkit.ValidationWarnings, error)
- func ValidateSchema(table *toolkit.Table, column *toolkit.Column, ...) toolkit.ValidationWarnings
- type CancelFunction
- type CmdTransformerBase
- func (ctb *CmdTransformerBase) BaseDone() error
- func (ctb *CmdTransformerBase) BaseInit(executable string, args []string) error
- func (ctb *CmdTransformerBase) BaseInitWithContext(ctx context.Context, executable string, args []string) error
- func (ctb *CmdTransformerBase) ReceiveStderrLine(ctx context.Context) (line []byte, err error)
- func (ctb *CmdTransformerBase) ReceiveStdoutLine(ctx context.Context) (line []byte, err error)
- func (ctb *CmdTransformerBase) Transform(ctx context.Context, r *toolkit.Record) (*toolkit.Record, error)
- type MetaKey
- type NewTransformerFunc
- type SchemaValidationFunc
- type Transformer
- type TransformerContext
- type TransformerDefinition
- type TransformerProperties
- type TransformerRegistry
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultTransformerRegistry = NewTransformerRegistry()
View Source
var ErrRowTransformationTimeout = errors.New("row transformation timeout")
Functions ¶
func DefaultSchemaValidator ¶
func DefaultSchemaValidator( ctx context.Context, driver *toolkit.Driver, properties *TransformerProperties, parameters map[string]*toolkit.StaticParameter) (toolkit.ValidationWarnings, error)
func ValidateSchema ¶
func ValidateSchema( table *toolkit.Table, column *toolkit.Column, columnProperties *toolkit.ColumnProperties, ) toolkit.ValidationWarnings
Types ¶
type CancelFunction ¶
type CancelFunction func() error
type CmdTransformerBase ¶
type CmdTransformerBase struct { Name string Cmd *exec.Cmd ExpectedExitCode int Driver *toolkit.Driver Api toolkit.InteractionApi ProcessedLines int RowTransformationTimeout time.Duration StdoutReader *bufio.Reader StderrReader *bufio.Reader StdinWriter io.Writer Cancel CancelFunction // contains filtered or unexported fields }
func NewCmdTransformerBase ¶
func NewCmdTransformerBase( name string, expectedExitCode int, rowTransformationTimeout time.Duration, driver *toolkit.Driver, api toolkit.InteractionApi, ) *CmdTransformerBase
func (*CmdTransformerBase) BaseDone ¶
func (ctb *CmdTransformerBase) BaseDone() error
func (*CmdTransformerBase) BaseInit ¶
func (ctb *CmdTransformerBase) BaseInit(executable string, args []string) error
func (*CmdTransformerBase) BaseInitWithContext ¶
func (*CmdTransformerBase) ReceiveStderrLine ¶
func (ctb *CmdTransformerBase) ReceiveStderrLine(ctx context.Context) (line []byte, err error)
func (*CmdTransformerBase) ReceiveStdoutLine ¶
func (ctb *CmdTransformerBase) ReceiveStdoutLine(ctx context.Context) (line []byte, err error)
type NewTransformerFunc ¶
type NewTransformerFunc func(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) ( Transformer, toolkit.ValidationWarnings, error, )
NewTransformerFunc - make new transformer. This function receives Driver for making some steps for validation or anything else. parameters - the map of the parsed parameters, for get an appropriate parameter find it in the map by the Name. All those parameters has been defined in the TransformerDefinition object of the transformer
type SchemaValidationFunc ¶
type SchemaValidationFunc func(ctx context.Context, table *toolkit.Driver, properties *TransformerProperties, parameters map[string]*toolkit.StaticParameter) (toolkit.ValidationWarnings, error)
type Transformer ¶
type TransformerContext ¶
type TransformerContext struct { Transformer Transformer StaticParameters map[string]*toolkit.StaticParameter DynamicParameters map[string]*toolkit.DynamicParameter When *toolkit.WhenCond }
func (*TransformerContext) EvaluateWhen ¶
func (tc *TransformerContext) EvaluateWhen(r *toolkit.Record) (bool, error)
type TransformerDefinition ¶
type TransformerDefinition struct { Properties *TransformerProperties `json:"properties"` New NewTransformerFunc `json:"-"` Parameters []*toolkit.ParameterDefinition `json:"parameters"` SchemaValidator SchemaValidationFunc `json:"-"` }
func NewTransformerDefinition ¶
func NewTransformerDefinition( properties *TransformerProperties, newTransformerFunc NewTransformerFunc, parameters ...*toolkit.ParameterDefinition, ) *TransformerDefinition
func (*TransformerDefinition) Instance ¶
func (d *TransformerDefinition) Instance( ctx context.Context, driver *toolkit.Driver, rawParams map[string]toolkit.ParamsValue, dynamicParameters map[string]*toolkit.DynamicParamValue, whenCond string, ) (*TransformerContext, toolkit.ValidationWarnings, error)
func (*TransformerDefinition) SetSchemaValidator ¶
func (d *TransformerDefinition) SetSchemaValidator(v SchemaValidationFunc) *TransformerDefinition
type TransformerProperties ¶
type TransformerProperties struct { Name string `json:"name"` Description string `json:"description"` IsCustom bool `json:"is_custom"` Meta map[MetaKey]any `json:"meta"` }
func NewTransformerProperties ¶
func NewTransformerProperties( name, description string, ) *TransformerProperties
func (*TransformerProperties) AddMeta ¶
func (tp *TransformerProperties) AddMeta(key MetaKey, value any) *TransformerProperties
type TransformerRegistry ¶
type TransformerRegistry struct {
M map[string]*TransformerDefinition
}
func NewTransformerRegistry ¶
func NewTransformerRegistry() *TransformerRegistry
func (*TransformerRegistry) Get ¶
func (tm *TransformerRegistry) Get(name string) (*TransformerDefinition, bool)
func (*TransformerRegistry) MustRegister ¶
func (tm *TransformerRegistry) MustRegister(definition *TransformerDefinition)
func (*TransformerRegistry) Register ¶
func (tm *TransformerRegistry) Register(definition *TransformerDefinition) error
Click to show internal directories.
Click to hide internal directories.