Documentation ¶
Overview ¶
Copyright (C) 2023 wwhai
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright (C) 2023 wwhai ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright (C) 2023 wwhai ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Variables
- type MAiBase
- type MApp
- type MCronResult
- type MCronTask
- type MDevice
- type MGenericGroup
- type MGenericGroupRelation
- type MGoods
- type MHnc8DataPoint
- type MHwPort
- type MInEnd
- type MInternalNotify
- type MIotProperty
- type MIotSchema
- type MIpRoute
- type MKnd8DataPoint
- type MModbusDataPoint
- type MNetworkConfig
- type MOutEnd
- type MRule
- type MSiemensDataPoint
- type MSiteConfig
- type MUser
- type MUserLuaTemplate
- type MVisual
- type MWifiConfig
- type PageRequest
- type PageResult
- type RulexModel
- type StringList
Constants ¶
This section is empty.
Variables ¶
var SysDefaultLogo = `` /* 9338-byte string literal not displayed */
Functions ¶
This section is empty.
Types ¶
type MAiBase ¶
type MAiBase struct { RulexModel UUID string `gorm:"uniqueIndex"` // 名称 Name string `gorm:"not null"` // 名称 Type string `gorm:"not null"` // 类型 IsBuildIn bool `gorm:"not null"` // 是否内建 Version string `gorm:"not null"` // 版本号 Filepath string `gorm:"not null"` // 文件路径, 是相对于main的apps目录 Description string `gorm:"not null"` }
* * 用户上传的AI数据[v0.5.0] *
type MApp ¶
type MApp struct { RulexModel UUID string `gorm:"uniqueIndex"` // 名称 Name string `gorm:"not null"` // 名称 Version string `gorm:"not null"` // 版本号 AutoStart *bool `gorm:"not null"` // 允许启动 LuaSource string `gorm:"not null"` // LuaSource Description string `gorm:"not null"` // 文件路径, 是相对于main的apps目录 }
* * LUA应用 *
type MCronResult ¶
type MCronResult struct { RulexModel TaskUuid string `gorm:"not null; default:''" json:"taskUuid,omitempty"` Status string `json:"status"` // CRON_RESULT_STATUS ExitCode string `json:"exitCode,omitempty"` // 0-success other-failed LogPath string `json:"logPath,omitempty"` StartTime time.Time `json:"startTime"` EndTime time.Time `json:"endTime"` }
*
- 任务结果
type MCronTask ¶
type MCronTask struct { RulexModel UUID string `gorm:"uniqueIndex,not null; default:''" json:"uuid"` Name string `gorm:"not null;" json:"name"` CronExpr string `gorm:"not null" json:"cronExpr"` // quartz cron expr Enable *bool `json:"enable"` // 是否启用定时任务 TaskType string `json:"taskType"` // CRON_TASK_TYPE,目前只有LINUX_SHELL Command string `json:"command"` // 根据TaskType而定,TaskType=LINUX_SHELL时Command=/bin/bash Args *string `json:"args"` // "-param1 -param2 -param3" IsRoot *bool `json:"isRoot"` // 是否使用root用户运行,目前不使用,默认和rulex用户一致 WorkDir string `json:"workDir"` // 目前不使用,默认工作路径和网关工作路径保持一致 Env string `json:"env"` // ["A=e1", "B=e2", "C=e3"] Script string `json:"script"` // 脚本内容,base64编码 UpdatedAt time.Time `json:"updatedAt"` }
*
- 定时任务
type MDevice ¶
type MDevice struct { RulexModel UUID string `gorm:"uniqueIndex"` Name string `gorm:"not null"` Type string `gorm:"not null"` Enable bool `gorm:"not null"` SchemaId string `gorm:"not null"` Config string BindRules StringList `json:"bindRules"` // 与之关联的规则表["A","B","C"] Description string }
设备元数据
type MGenericGroup ¶
type MGenericGroup struct { RulexModel UUID string `gorm:"uniqueIndex"` Name string `gorm:"not null"` // 名称 Type string `gorm:"not null"` // 组的类型, DEVICE: 设备分组 Parent string `gorm:"not null"` // 上级, 如果是0表示根节点 }
* * 通用分组 *
type MGenericGroupRelation ¶
type MGenericGroupRelation struct { RulexModel UUID string `gorm:"uniqueIndex"` Gid string `gorm:"not null"` // 分组ID Rid string `gorm:"not null"` // 被绑定方 }
* * 分组表的绑定关系表 *
type MGoods ¶
type MGoods struct { RulexModel UUID string `gorm:"uniqueIndex"` LocalPath string `gorm:"not null"` GoodsType string `gorm:"not null"` // LOCAL, EXTERNAL ExecuteType string `gorm:"not null"` // exe,elf,js,py.... AutoStart *bool `gorm:"not null"` NetAddr string `gorm:"not null"` Args string `gorm:"not null"` Description string `gorm:"not null"` }
type MHnc8DataPoint ¶ added in v0.6.7
type MHnc8DataPoint struct { RulexModel `json:"-"` UUID string `gorm:"not null"` DeviceUuid string `gorm:"not null"` Name string `gorm:"not null"` // 点位名称 Alias string `gorm:"not null"` // 别名 ApiFunction string `gorm:"not null"` // API路径 Group int `gorm:"not null"` // 分组采集 Address string `gorm:"not null"` // 地址 }
华中数控
type MHwPort ¶
type MHwPort struct { RulexModel UUID string `gorm:"not null"` Name string `gorm:"not null"` // 接口名称 Type string `gorm:"not null"` // 接口类型, UART(串口),USB(USB),FD(通用文件句柄) Alias string `gorm:"not null"` // 别名 Description string `gorm:"not null"` // 额外备注 Config string `gorm:"not null"` // 配置, 串口配置、或者网卡、USB等 }
type MInEnd ¶
type MInEnd struct { RulexModel // UUID for origin source ID UUID string `gorm:"uniqueIndex"` Type string `gorm:"not null"` Enable bool `gorm:"not null"` Name string `gorm:"not null"` BindRules StringList `json:"bindRules"` // 与之关联的规则表["A","B","C"] Description string Config string XDataModels string }
type MInternalNotify ¶
type MInternalNotify struct { RulexModel UUID string `gorm:"not null"` // UUID Type string `gorm:"not null"` // INFO | ERROR | WARNING Status int `gorm:"not null"` // 1 未读 2 已读 Event string `gorm:"not null"` // 字符串 Ts uint64 `gorm:"not null"` // 时间戳 Summary string `gorm:"not null"` // 概览,为了节省流量,在消息列表只显示这个字段,Info值为“” Info string `gorm:"not null"` // 消息内容,是个文本,详情显示 }
* * 内部通知 *
type MIotProperty ¶ added in v0.6.6
type MIotProperty struct { RulexModel SchemaId string `gorm:"not null"` UUID string `gorm:"not null"` Label string `gorm:"not null"` // UI显示的那个文本 Name string `gorm:"not null"` // 变量关联名 Type string `gorm:"not null"` // 类型, 只能是上面几种 Rw string `gorm:"not null"` // R读 W写 RW读写 Unit string `gorm:"not null"` // 单位 例如:摄氏度、米、牛等等 Rule string `gorm:"not null"` // 规则,IoTPropertyRule Description string // 额外信息 }
* * 属性 *
type MIotSchema ¶ added in v0.6.6
type MIotSchema struct { RulexModel UUID string `gorm:"not null"` Name string `gorm:"not null"` // 名称 Description string // 额外信息 }
* * 物模型 *
type MIpRoute ¶
type MIpRoute struct { RulexModel UUID string `gorm:"not null"` Iface string `gorm:"not null"` // 用来做子网的那个网卡的网卡名 Ip string `gorm:"not null"` // 用来做子网的那个网卡的IP地址 Gateway string `gorm:"not null"` // 用来做子网的那个网卡的网关 Network string `gorm:"not null"` // 用来做子网的那个网卡的网段 Netmask string `gorm:"not null"` // 用来做子网的那个网卡子网掩码 IpPoolBegin string `gorm:"not null"` // DHCP IP地址池起始 IpPoolEnd string `gorm:"not null"` // DHCP IP地址池结束 //------------------------------------ // IP 路由方向, 默认 ETH1 透传到 4G //------------------------------------ IfaceFrom string `gorm:"not null"` // 流量入口 IfaceTo string `gorm:"not null"` // 流量出口 }
* * Linux默认路由,该配置主要用来处理软路由相关功能 // 每次启动的时候换成最新配置的路由, 默认是ETH1 192.168.64.0 // 这个初始化的目的是为了配合软路由使用, 和isc-dhcp-server、dnsmasq 两个DHCP服务有关
type MKnd8DataPoint ¶ added in v0.6.7
type MKnd8DataPoint struct { RulexModel `json:"-"` UUID string `gorm:"not null"` DeviceUuid string `gorm:"not null"` Name string `gorm:"not null"` // 点位名称 Alias string `gorm:"not null"` // 别名 ApiFunction string `gorm:"not null"` // API路径 Group int `gorm:"not null"` // 分组采集 Address string `gorm:"not null"` // 地址 }
华中数控
type MModbusDataPoint ¶
type MModbusDataPoint struct { RulexModel `json:"-"` UUID string `gorm:"not null"` DeviceUuid string `gorm:"not null"` Tag string `gorm:"not null"` Alias string `gorm:"not null"` Function *int `gorm:"not null"` SlaverId *byte `gorm:"not null"` Address *uint16 `gorm:"not null"` Frequency *int64 `gorm:"not null"` Quantity *uint16 `gorm:"not null"` Type string `gorm:"not null"` // 数据类型 Order string `gorm:"not null"` // 字节序 Weight *float64 `gorm:"not null"` // 权重 }
modbus数据点位表
type MNetworkConfig ¶
type MNetworkConfig struct { RulexModel Type string `gorm:"not null"` // 类型: ubuntu16, ubuntu18 Interface string `gorm:"not null"` // eth1 eth0 Address string `gorm:"not null"` Netmask string `gorm:"not null"` Gateway string `gorm:"not null"` DNS StringList `gorm:"not null"` DHCPEnabled *bool `gorm:"not null"` }
* * 系统配置参数, 直接以String保存,完了以后再加工成Dto结构体 *
type MOutEnd ¶
type MSiemensDataPoint ¶
type MSiemensDataPoint struct { RulexModel UUID string `gorm:"not null"` DeviceUuid string `gorm:"not null"` // 所属设备 SiemensAddress string `gorm:"not null"` // 西门子的地址字符串 Tag string `gorm:"not null"` // Tag Alias string `gorm:"not null"` // 别名 DataBlockType string `gorm:"not null"` // 类型 INT UINT.... DataBlockOrder string `gorm:"not null"` // 字节序 Weight *float64 `gorm:"not null"` // 权重 Frequency *int64 `gorm:"not null"` // 采集频率 }
西门子数据点位表
type MSiteConfig ¶
type MSiteConfig struct { RulexModel UUID string `gorm:"not null"` SiteName string `gorm:"not null"` // 浏览器title栏 Logo string `gorm:"not null"` // logo AppName string `gorm:"not null"` // 左上角名称 }
* * 浏览器个性化配置 *
type MUser ¶
type MUser struct { RulexModel Role string `gorm:"not null"` Username string `gorm:"not null"` Password string `gorm:"not null"` Description string }
type MUserLuaTemplate ¶
type MUserLuaTemplate struct { RulexModel UUID string Gid string // 分组 Type string // 类型 固定为 'function' Label string //快捷代码名称 Apply string //快捷代码 Variables string //变量 Detail string }
* * 用户自定义代码模板 *
func (MUserLuaTemplate) GenVariables ¶
func (md MUserLuaTemplate) GenVariables(V []dto.LuaTemplateVariables) (string, error)
* * 生成字符串 *
func (MUserLuaTemplate) GetVariables ¶
func (md MUserLuaTemplate) GetVariables() []dto.LuaTemplateVariables
* * 获取其变量表 *
type MVisual ¶
type MVisual struct { RulexModel UUID string `gorm:"uniqueIndex"` // 名称 Name string `gorm:"not null"` // 名称 Type string `gorm:"not null"` // 类型 Status bool `gorm:"not null"` // 状态, EDITING, PUBLISH Content string `gorm:"not null"` // 大屏的内容 Thumbnail string `gorm:"not null"` // 缩略图 }
-------------------------------------------------------------------------------------------------- 0.6.0 --------------------------------------------------------------------------------------------------
* * 大屏 *
type MWifiConfig ¶
type MWifiConfig struct { RulexModel Interface string `gorm:"not null"` SSID string `gorm:"not null"` Password string `gorm:"not null"` Security string `gorm:"not null"` // wpa2-psk wpa3-psk }
* * 无线网络配置 *
type PageRequest ¶
type PageResult ¶
type RulexModel ¶
type StringList ¶
type StringList []string
func (StringList) Len ¶
func (f StringList) Len() int
func (StringList) String ¶
func (f StringList) String() string