Skip to content

Commit

Permalink
docs: changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienaury committed Sep 19, 2024
1 parent c5ab707 commit 236ec52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ Types of changes

## [1.27.0]

- `Added` parameter `maxstrlen` to `sha3` and `haqhInCSV` masks
- `Fixed` type casting issues when using `add`, `add-transient`, `choice` or `hash` to create complex structures
- `Added` parameter `maxstrlen` to `sha3` and `hashInCSV` masks
- `Fixed` type casting issues when using `add`, `add-transient`, `choice`, `weightedChoice` or `hash` to create complex structures
- `Fixed` performance issue with `pipe` mask
- `Fixed` performance issue with selectors

## [1.26.2]

Expand Down
24 changes: 10 additions & 14 deletions pkg/pipe/pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,22 @@ func NewMask(seed int64, injectParent string, injectRoot string, caches map[stri
return MaskEngine{"", pipeline, injectParent, injectRoot}, err
}

func (me MaskEngine) MaskContext(e model.Dictionary, key string, context ...model.Dictionary) (model.Dictionary, error) {
func (me MaskEngine) MaskContext(entry model.Dictionary, key string, context ...model.Dictionary) (model.Dictionary, error) {
log.Info().Msg("Mask pipe")
var result []model.Entry
input := []model.Dictionary{}

// copy := model.CopyDictionary(e)
copy := e

value, ok := e.GetValue(key)
value, ok := entry.GetValue(key)
if !ok || value == nil {
return copy, nil
return entry, nil
}

for _, elemInput := range model.CleanDictionarySlice(e.Get(key)) {
for _, elemInput := range model.CleanDictionarySlice(entry.Get(key)) {
if len(me.injectParent) > 0 {
elemInput.Set(me.injectParent, copy)
elemInput.Set(me.injectParent, entry)
}
if len(me.injectRoot) > 0 {
rootcopy := model.CopyDictionary(context[0])
elemInput.Set(me.injectRoot, rootcopy)
elemInput.Set(me.injectRoot, model.CopyDictionary(context[0]))
}
input = append(input, elemInput)
}
Expand All @@ -85,7 +81,7 @@ func (me MaskEngine) MaskContext(e model.Dictionary, key string, context ...mode
if len(me.source) > 0 {
over.MDC().Set("config", me.source)
}
// TODO: possible refactoring
// possible refactoring
// model.NewSourceFromSlice(input).
// Process(model.NewCounterProcessWithCallback("input-line", 1, updateContext)).
// Process(me.pipeline).
Expand All @@ -100,7 +96,7 @@ func (me MaskEngine) MaskContext(e model.Dictionary, key string, context ...mode
over.MDC().Set("path", savePath)
over.MDC().Set("context", saveContext)
if err != nil {
return copy, err
return entry, err
}
for _, dict := range result {
if len(me.injectParent) > 0 {
Expand All @@ -110,8 +106,8 @@ func (me MaskEngine) MaskContext(e model.Dictionary, key string, context ...mode
dict.(model.Dictionary).Delete(me.injectRoot)
}
}
copy.Set(key, result)
return copy, nil
entry.Set(key, result)
return entry, nil
}

// Factory create a mask from a configuration
Expand Down

0 comments on commit 236ec52

Please sign in to comment.