Skip to content

Commit

Permalink
code(pkg/utils/expression) - add json string
Browse files Browse the repository at this point in the history
  • Loading branch information
PxyUp committed Feb 1, 2024
1 parent 607d7ce commit 3aec826
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,8 @@ type CalculatedConfig struct {

**fIndex** - it is index in parent array(only if parent was array field)

**fResJson** - it is JSON string representation of the raw result

```json
{
"type": "bool",
Expand Down
6 changes: 4 additions & 2 deletions pkg/utils/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
)

const (
fitterResultRef = "fRes"
fitterIndexRef = "fIndex"
fitterResultJsonRef = "fResJson"
fitterResultRef = "fRes"
fitterIndexRef = "fIndex"
)

var (
Expand All @@ -23,6 +24,7 @@ func extendEnv(env map[string]interface{}, result builder.Jsonable, index *uint3

if result != nil {
kv[fitterResultRef] = result.Raw()
kv[fitterResultJsonRef] = result.ToJson()
}
if index != nil {
kv[fitterIndexRef] = *index
Expand Down

0 comments on commit 3aec826

Please sign in to comment.