Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyInput is returned when we try to modify an empty value ErrEmptyInput = errors.New("validation error: transformer input is empty") )
Functions ¶
This section is empty.
Types ¶
type FindSubMatch ¶ added in v0.21.0
type FindSubMatch struct {
// Pattern defines regular expression to use for retrieving a submatch
Pattern string `yaml:",omitempty" jsonschema:"required"`
DeprecatedCaptureIndex int `yaml:"captureIndex,omitempty" jsonschema:"-"`
// CaptureIndex defines which substring occurrence to retrieve. Note also that a value of `0` for `captureIndex` returns all submatches, and individual submatch indexes start at `1`.
CaptureIndex int
}
FindSubMatch is a struct used to feed regexp.findSubMatch
func (*FindSubMatch) Apply ¶ added in v0.25.0
func (f *FindSubMatch) Apply(input string) (string, error)
func (*FindSubMatch) Validate ¶ added in v0.25.0
func (f *FindSubMatch) Validate() error
type Replacer ¶
type Replacer struct {
// From defines the source value which need to be replaced
From string `yaml:",omitempty" jsonschema:"required"`
// To defines the "to what" a "from" value needs to be replaced
To string `yaml:",omitempty" jsonschema:"required"`
}
Replacer is struct used to feed strings.Replacer
type Transformer ¶
type Transformer struct {
// AddPrefix adds a prefix to the transformer input value
AddPrefix string `yaml:",omitempty"`
DeprecatedAddPrefix string `yaml:"addPrefix,omitempty" jsonschema:"-"`
// AddSuffix adds a suffix to the transformer input value
AddSuffix string `yaml:",omitempty"`
DeprecatedAddSuffix string `yaml:"addSuffix,omitempty" jsonschema:"-"`
// TrimPrefix removes a prefix to the transformer input value
TrimPrefix string `yaml:",omitempty"`
DeprecatedTrimPrefix string `yaml:"trimPrefix,omitempty" jsonschema:"-"`
// TrimSuffix removes the suffix from the transformer input value
TrimSuffix string `yaml:",omitempty"`
DeprecatedTrimSuffix string `yaml:"trimSuffix,omitempty" jsonschema:"-"`
// Replacers specifies a list of replacer instruction
Replacers Replacers `yaml:",omitempty"`
// Replacer specifies what value needs to be changed and how
Replacer Replacer `yaml:",omitempty"`
// Find searches for a specific value if it exists and return false if it doesn't
Find string `yaml:",omitempty"`
// Find searches for a specific value if it exists then return the value using regular expression
FindSubMatch FindSubMatch `yaml:",omitempty"`
DeprecatedFindSubMatch interface{} `yaml:"findSubMatch,omitempty" jsonschema:"-"`
// SemvVerInc specifies a comma separated list semantic versioning component that needs to be upgraded.
SemVerInc string `yaml:",omitempty"`
DeprecatedSemVerInc string `yaml:"semverInc,omitempty" jsonschema:"-"`
// Quote add quote around the value
Quote bool `yaml:",omitempty"`
// Unquote remove quotes around the value
Unquote bool `yaml:",omitempty"`
}
Transformer holds a transformer rule
func (*Transformer) Apply ¶
func (t *Transformer) Apply(input string) (output string, err error)
Apply applies a single transformation based on a key
func (*Transformer) Validate ¶ added in v0.25.0
func (t *Transformer) Validate() error
type Transformers ¶
type Transformers []Transformer
Transformers defines a list of transformer applied in order
func (*Transformers) Apply ¶
func (t *Transformers) Apply(input string) (string, error)
Apply applies a list of transformers
func (*Transformers) Validate ¶ added in v0.25.0
func (t *Transformers) Validate() error
Click to show internal directories.
Click to hide internal directories.