mirror of
https://github.com/gl-inet/glkvm-cloud.git
synced 2026-09-19 17:15:18 +00:00
0d1d2b0adf
1. Add support for device online and offline status detection based on in-memory connections. 2. Enhance the device list to support updating and displaying device descriptions for easier management. Signed-off-by: GL.iNet-Yongping.Xie <yongping.xie@gl-inet.com>
17 lines
950 B
Go
Executable File
17 lines
950 B
Go
Executable File
package db
|
|
|
|
// DeviceMeta represents a record in the gl_device table.
|
|
type DeviceMeta struct {
|
|
DeviceID string `gorm:"primaryKey;column:device_id"` // DeviceID is the globally unique and immutable ID of the device.
|
|
Mac string `gorm:"uniqueIndex;column:mac"` // Mac is the unique and immutable MAC address of the device.
|
|
IP string `gorm:"column:ip"` // IP is the current IP address of the device.
|
|
Description string `gorm:"column:description"` // Description is a human-readable description of the device.
|
|
CreateTime int64 `gorm:"column:create_time"` // CreateTime is the creation timestamp (Unix time).
|
|
UpdateTime int64 `gorm:"column:update_time"` // UpdateTime is the last update timestamp (Unix time).
|
|
}
|
|
|
|
// TableName sets the name of the table in the database that this struct binds to.
|
|
func (DeviceMeta) TableName() string {
|
|
return "devices"
|
|
}
|