mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
[feat]添加规则引擎debug功能
This commit is contained in:
18
pkg/tdengine/tdengine_rule_debug.go
Normal file
18
pkg/tdengine/tdengine_rule_debug.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package tdengine
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const debugTableName = "device_rule_debug"
|
||||
|
||||
func (s *TdEngine) CreateDeviceRuleDebugTable() (err error) {
|
||||
sql := fmt.Sprintf(`CREATE TABLE IF NOT EXISTS %s.%s (ts TIMESTAMP,nodeId NCHAR(64),msgd NCHAR(64),debugType NCHAR(64),
|
||||
deviceName NCHAR(64),msgType NCHAR(64),msg VARCHAR,metadata VARCHAR,error VARCHAR)`, s.dbName, debugTableName)
|
||||
_, err = s.db.Exec(sql)
|
||||
return
|
||||
}
|
||||
|
||||
func (s *TdEngine) InsertRuleDebug(data map[string]any) (err error) {
|
||||
return s.InsertDevice(debugTableName, data)
|
||||
}
|
||||
Reference in New Issue
Block a user