You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
2.9 KiB
49 lines
2.9 KiB
package model
|
|
|
|
import "time"
|
|
|
|
// Dock 机巢
|
|
type Dock struct {
|
|
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
|
|
UserID int64 `gorm:"column:user_id;type:BIGINT;not null" json:"userId"`
|
|
DockID string `gorm:"column:dock_id;type:VARCHAR(64);not null;uniqueIndex:idx_dock_id" json:"dockId"`
|
|
Name string `gorm:"column:name;type:VARCHAR(64);default:''" json:"name"`
|
|
Code string `gorm:"column:code;type:VARCHAR(32);default:''" json:"code"`
|
|
SN string `gorm:"column:sn;type:VARCHAR(64);default:''" json:"sn"`
|
|
Iccid string `gorm:"column:iccid;type:VARCHAR(32);default:''" json:"iccid"` // 冗余,权威见 sim_card.iccid
|
|
Longitude float64 `gorm:"column:longitude;type:DOUBLE;default:0" json:"longitude"`
|
|
Latitude float64 `gorm:"column:latitude;type:DOUBLE;default:0" json:"latitude"`
|
|
Altitude float64 `gorm:"column:altitude;type:DOUBLE;default:0" json:"altitude"`
|
|
Location string `gorm:"column:location;type:VARCHAR(128);default:''" json:"location"`
|
|
Status string `gorm:"column:status;type:VARCHAR(32);default:offline" json:"status"`
|
|
RegisterStatus string `gorm:"column:register_status;type:VARCHAR(16);default:pending" json:"registerStatus"`
|
|
DockIDSource string `gorm:"column:dock_id_source;type:VARCHAR(32);default:''" json:"dockIdSource"`
|
|
SoftwareVer string `gorm:"column:software_ver;type:VARCHAR(16);default:''" json:"softwareVer"`
|
|
ProtocolVer string `gorm:"column:protocol_ver;type:VARCHAR(8);default:'1.0'" json:"protocolVer"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
|
|
}
|
|
|
|
func (Dock) TableName() string {
|
|
return "dock"
|
|
}
|
|
|
|
// Drone 无人机(与机巢默认一对一绑定)
|
|
type Drone struct {
|
|
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
|
|
UserID int64 `gorm:"column:user_id;type:BIGINT;not null" json:"userId"`
|
|
DroneSN string `gorm:"column:drone_sn;type:VARCHAR(32);not null;uniqueIndex:idx_drone_sn" json:"droneSn"`
|
|
DockID string `gorm:"column:dock_id;type:VARCHAR(64);not null;uniqueIndex:idx_drone_dock" json:"dockId"`
|
|
Name string `gorm:"column:name;type:VARCHAR(64);default:''" json:"name"`
|
|
Code string `gorm:"column:code;type:VARCHAR(32);default:''" json:"code"`
|
|
Model string `gorm:"column:model;type:VARCHAR(32);default:''" json:"model"`
|
|
Status string `gorm:"column:status;type:VARCHAR(32);default:offline" json:"status"`
|
|
Battery int `gorm:"column:battery;type:INT;default:0" json:"battery"`
|
|
FirmwareVer string `gorm:"column:firmware_ver;type:VARCHAR(16);default:''" json:"firmwareVer"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
|
|
}
|
|
|
|
func (Drone) TableName() string {
|
|
return "drone"
|
|
}
|
|
|