diff --git a/apps/rule/api/rulechain.go b/apps/rule/api/rulechain.go index bf17aa4..b95172b 100644 --- a/apps/rule/api/rulechain.go +++ b/apps/rule/api/rulechain.go @@ -24,9 +24,8 @@ func (r *RuleChainApi) GetNodeLabels(rc *restfulx.ReqCtx) { func (r *RuleChainApi) RuleChainTest(rc *restfulx.ReqCtx) { code := restfulx.QueryParam(rc, "code") instance, _ := rule_engine.NewRuleChainInstance([]byte(code)) - newMessage := message.NewMessage() - newMessage.SetMetadata(message.NewMetadata()) - instance.StartRuleChain(context.Background(), newMessage) + msg := message.NewMessage("1", message.TelemetryMes, message.Msg{"temperature": 60.4, "humidity": 32.5}, message.Metadata{}) + instance.StartRuleChain(context.Background(), msg) rc.ResData = []map[string]interface{}{} } diff --git a/go.mod b/go.mod index 31690b1..e493780 100644 --- a/go.mod +++ b/go.mod @@ -76,6 +76,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect + github.com/gorilla/schema v1.2.0 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect diff --git a/go.sum b/go.sum index 5f1cbeb..f57cb73 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,6 @@ github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1 github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/PandaXGO/PandaKit v0.0.0-20230628055017-c47e7aa81cd4 h1:SlGUf970WIctMhu8ZZBNsZfY1bdCbGGo9wLm5V0ceeM= -github.com/PandaXGO/PandaKit v0.0.0-20230628055017-c47e7aa81cd4/go.mod h1:iyVx5byF4Z//dBpXMy22ZtgSnQAN/U9qjwGyU02QfSA= github.com/PandaXGO/PandaKit v0.0.0-20230901074047-e0e8e4bf2bed h1:O8K3C8IoadfpY+VKSMcaPRadPO1DDZbbj4B1opl9ntM= github.com/PandaXGO/PandaKit v0.0.0-20230901074047-e0e8e4bf2bed/go.mod h1:/H1PTodkWhRyVqE/1tROVJEO2nwqwE6el7ZzwSebLxY= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -200,6 +198,8 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc= +github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=