32 lines
1010 B
Go
32 lines
1010 B
Go
package models
|
|
|
|
import "time"
|
|
|
|
// MQTTMsg maps to table t_mqtt_msg in emqx_data
|
|
type MQTTMsg struct {
|
|
ID uint `gorm:"primaryKey;column:id"`
|
|
MsgID string `gorm:"column:msgid;type:varchar(64)"`
|
|
Sender string `gorm:"column:sender;type:varchar(64)"`
|
|
Topic string `gorm:"column:topic;type:varchar(255)"`
|
|
QoS int `gorm:"column:qos"`
|
|
Retain int `gorm:"column:retain"`
|
|
Payload string `gorm:"column:payload;type:text"`
|
|
Arrived time.Time `gorm:"column:arrived"`
|
|
}
|
|
|
|
func (MQTTMsg) TableName() string {
|
|
return "t_mqtt_msg"
|
|
}
|
|
|
|
// EmqxClientEvent maps to table emqx_client_events in emqx_data
|
|
type EmqxClientEvent struct {
|
|
ID uint `gorm:"primaryKey;column:id"`
|
|
ClientID string `gorm:"column:clientid;type:varchar(255)"`
|
|
Event string `gorm:"column:event;type:varchar(255)"`
|
|
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
|
|
}
|
|
|
|
func (EmqxClientEvent) TableName() string {
|
|
return "emqx_client_events"
|
|
}
|