Skip to content

Commit

Permalink
Merge branch 'master' of github.com:myrteametrics/myrtea-engine-api i…
Browse files Browse the repository at this point in the history
…nto async-export
  • Loading branch information
SchawnnDev committed Nov 29, 2023
2 parents ea541ad + af22fd2 commit fb19f06
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/json-iterator/go v1.1.12
github.com/lestrrat-go/jwx v1.2.6
github.com/lib/pq v1.0.0
github.com/myrteametrics/myrtea-sdk/v4 v4.4.5
github.com/myrteametrics/myrtea-sdk/v4 v4.4.7
github.com/olivere/elastic v6.2.16+incompatible
github.com/prataprc/goparsec v0.0.0-20180806094145-2600a2a4a410
github.com/prometheus/client_golang v1.14.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/myrteametrics/myrtea-sdk/v4 v4.4.5 h1:8dbIWpNLzvOq9/fQTiJUpZd56NRVAEoAmcRQoC+uD5c=
github.com/myrteametrics/myrtea-sdk/v4 v4.4.5/go.mod h1:wa9nwNcFGpGbZeqXXqhTLp7sXERbCrRhhcASGY6H0QA=
github.com/myrteametrics/myrtea-sdk/v4 v4.4.7 h1:cIn6+hCgzGAaWGjtAm0rFPdXX/cl6z4wWQuWI+KG9eQ=
github.com/myrteametrics/myrtea-sdk/v4 v4.4.7/go.mod h1:wa9nwNcFGpGbZeqXXqhTLp7sXERbCrRhhcASGY6H0QA=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
Expand Down
21 changes: 3 additions & 18 deletions internals/processor/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"go.uber.org/zap"
)

//ReceiveObjects ...
// ReceiveObjects ...
func ReceiveObjects(factObjectName string, documents []sdk_models.Document) error {
factObject, found, err := fact.R().GetByName(factObjectName)
if err != nil {
Expand All @@ -30,10 +30,7 @@ func ReceiveObjects(factObjectName string, documents []sdk_models.Document) erro
continue
}

source, ok := document.Source.(map[string]interface{})
if !ok {
return err
}
source := document.Source
source["id"] = document.ID

// Not working ATM (Field are flatten + array theorically not supported)
Expand Down Expand Up @@ -63,19 +60,7 @@ func filterSource(f engine.Fact, source map[string]interface{}) map[string]inter
}

func objectFilterKeep(f engine.Fact, document sdk_models.Document) bool {
// // check model
// if f.Model != document.IndexType {
// zap.L().Debug("DEBUG TMP, filtered by model")
// return false
// }

// check content
source, ok := document.Source.(map[string]interface{})
if !ok {
zap.L().Debug("DEBUG TMP, not a map")
return false
}
return applyCondition(f.Condition, source)
return applyCondition(f.Condition, document.Source)
}

func applyCondition(c engine.ConditionFragment, source map[string]interface{}) bool {
Expand Down

0 comments on commit fb19f06

Please sign in to comment.