Documentation ¶
Index ¶
- func Count(tab interface{}, query string, where ...interface{}) (count int64)
- func Create(tab interface{}) bool
- func CreateTable(tab interface{})
- func Find(out interface{}, tableName string, where ...interface{})
- func First(tab interface{}, where ...interface{}) bool
- func GetTableName(value interface{}) (tableName string)
- func InitChannelList()
- func InitDB()
- func InitDeviceList()
- func Limit(out interface{}, tableName string, limit, offset int, where ...interface{})
- func Save(tab interface{}) bool
- func UpdateTable(sql string)
- func Updates(tbl interface{}, data interface{})
- type ChannelList
- type DeviceList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Find ¶
func Find(out interface{}, tableName string, where ...interface{})
查询所有记录,参数一为结构体数组指针,参数二为表名,后面参数是查询套件
func First ¶
func First(tab interface{}, where ...interface{}) bool
查询符合条件的第一条记录,有数据返回true,无数据返回false
Types ¶
type ChannelList ¶
type ChannelList struct { ID int ChannelID string `gorm:"column:ChannelID;primary_key" json:"channelID"` //ChannelID=DeviceID_Number ChannelName string `gorm:"column:ChannelName" json:"channelName"` DeviceID string `gorm:"column:DeviceID" json:"deviceID"` Status string `gorm:"column:Status" json:"status"` //通道在线状态,ON-在线,OFF-离线 CreatedAt config.TimeNormal `gorm:"column:CreatedAt" json:"createdAt"` UpdatedAt config.TimeNormal `gorm:"column:UpdatedAt" json:"updatedAt"` }
通道列表
type DeviceList ¶
type DeviceList struct { ID int DeviceID string `gorm:"column:DeviceID;primary_key" json:"deviceID"` //设备ID DeviceIP string `gorm:"column:DeviceIP" json:"deviceIP"` //来自设备注册时的UDPAddr DeviceName string `gorm:"column:DeviceName" json:"deviceName"` SerialNumber string `gorm:"column:SerialNumber" json:"serialNumber"` //设备序列号 Status string `gorm:"column:Status" json:"status"` //设备在线状态,ON-在线,OFF-离线 CreatedAt config.TimeNormal `gorm:"column:CreatedAt" json:"createdAt"` UpdatedAt config.TimeNormal `gorm:"column:UpdatedAt" json:"updatedAt"` }
设备列表
Click to show internal directories.
Click to hide internal directories.