Skip to content

Commit

Permalink
working tests
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT committed Dec 18, 2024
1 parent b724fe1 commit 37c21a9
Show file tree
Hide file tree
Showing 8 changed files with 434 additions and 381 deletions.
36 changes: 14 additions & 22 deletions pkg/ottl/contexts/internal/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,15 @@ func GetMapValue[K any](ctx context.Context, tCtx K, m pcommon.Map, keys []ottl.
if err != nil {
return nil, err
}
if p != nil {
res, err := p.Get(ctx, tCtx)
if err != nil {
return nil, err
}
resString, ok := res.(string)
if !ok {
return nil, fmt.Errorf("err")
}
s = &resString
} else {
res, err := p.Get(ctx, tCtx)
if err != nil {
return nil, err
}
resString, ok := res.(string)
if !ok {
return nil, fmt.Errorf("non-string indexing is not supported")
}
s = &resString
}

val, ok := m.Get(*s)
Expand All @@ -63,19 +59,15 @@ func SetMapValue[K any](ctx context.Context, tCtx K, m pcommon.Map, keys []ottl.
if err != nil {
return err
}
if p != nil {
res, err := p.Get(ctx, tCtx)
if err != nil {
return err
}
resString, ok := res.(string)
if !ok {
return fmt.Errorf("err")
}
s = &resString
} else {
res, err := p.Get(ctx, tCtx)
if err != nil {
return err
}
resString, ok := res.(string)
if !ok {
return fmt.Errorf("non-string indexing is not supported")
}
s = &resString
}

currentValue, ok := m.Get(*s)
Expand Down
Loading

0 comments on commit 37c21a9

Please sign in to comment.