Documentation
¶
Index ¶
- Constants
- func CountDevice(conditions interface{}) (int64, error)
- func CountProtocol(conditions interface{}) (int64, error)
- func DeleteDevice(id int) error
- func DeleteProtocol(id int) error
- func GetDB() *gorm.DB
- func InitDB()
- func Paginate(pageNum int, pageSize int) func(db *gorm.DB) *gorm.DB
- type Device
- type Model
- type Protocol
- func CreateProtocol(protocol *Protocol) (*Protocol, error)
- func GetProtocol(id int) (*Protocol, error)
- func GetProtocols(pageNum int, pageSize int, maps interface{}, order string) ([]*Protocol, error)
- func GetProtocolsByDeviceId(deviceId int) ([]*Protocol, error)
- func UpdateProtocol(id int, data interface{}) (*Protocol, error)
Constants ¶
View Source
const ( DeviceRunning = "running" DeviceIdle = "idle" DeviceError = "error" )
Variables ¶
This section is empty.
Functions ¶
func CountDevice ¶
func CountProtocol ¶
func DeleteDevice ¶
func DeleteProtocol ¶
Types ¶
type Device ¶
type Device struct {
Model
Name string `json:"name"`
Type string `json:"type"`
ServerIp string `json:"server_ip"`
ServerPort string `json:"server_port"`
State string `json:"state"` // [running, idle, error]
}
func CreateDevice ¶
func GetDevices ¶
func UpdateDevice ¶
type Protocol ¶
type Protocol struct {
Model
DeviceId int `json:"device_id"`
Name string `json:"name"`
Content datatypes.JSON `json:"content"`
Qos int `json:"qos"`
Type int `json:"type"` // 0--自发, 1--响应
SubTopic string `json:"sub_topic"`
PubTopic string `json:"pub_topic"`
Strategy datatypes.JSON `json:"strategy"`
}
func CreateProtocol ¶
func GetProtocol ¶
func GetProtocols ¶
func GetProtocolsByDeviceId ¶
func UpdateProtocol ¶
Click to show internal directories.
Click to hide internal directories.