Documentation ¶
Overview ¶
Package common provides the utility functions and type needed by all specialized step packages
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMissingParameter = errors.New("MISSING PARAMETER")
ErrMissingParameter raise when a parameter is missing in step definition.
var ErrWrongParameterValue = errors.New("WRONG PARAMETER VALUE")
ErrWrongParameterValue raise when a parameter as a wrong value in step definition.
Functions ¶
func ToSkipDatabase ¶
func ToSkipDatabase(ctx context.Context, log *logrus.Entry, ds datasource.Datasourcer, admin bool, nodb bool, queries []SkipQuery) (bool, error)
ToSkipDatabase run the query (likely a SELECT COUNT) on the datasource return true if the query return a non-zero value in the only column of the only row.
Types ¶
type SkipQuery ¶ added in v1.2.0
type SkipQuery struct {
// contains filtered or unexported fields
}
SkipQuery contains parameters for a skip query where the query is templated with the parameters of the datasource.
func RenderQueries ¶ added in v1.2.0
func RenderQueries(log *logrus.Entry, tqueries []TemplateSkipQuery, tmplValues datasource.TmplValues) ([]SkipQuery, error)
RenderQueries render the templated query with parameter corresponding to the datasource.
type Steper ¶
type Steper interface { Do(context.Context, *logrus.Entry) error Cancel(*logrus.Entry) Finish(log *logrus.Entry) Init(context.Context, *logrus.Entry) error ToSkip(context.Context, *logrus.Entry) (bool, error) PostLoad(*logrus.Entry, map[string]string) error }
Steper Interface that will be used to run the steps.
type TemplateSkipQuery ¶ added in v1.2.0
type TemplateSkipQuery struct {
// contains filtered or unexported fields
}
TemplateSkipQuery contains parameters for a skip query parsed from string of step configuration file.
func ParseQueries ¶ added in v1.2.0
func ParseQueries(log *logrus.Entry, queriesTmpl []string) ([]TemplateSkipQuery, error)
ParseQueries parse the queries templates from step configuration file.