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.
38 lines
1.6 KiB
38 lines
1.6 KiB
package model
|
|
|
|
import "time"
|
|
|
|
// Route 航线
|
|
type Route 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"`
|
|
Name string `gorm:"column:name;type:VARCHAR(128);not null" json:"name"`
|
|
Description string `gorm:"column:description;type:VARCHAR(256)" json:"description"`
|
|
// WaypointCount is populated by route list/detail queries and is not stored
|
|
// on the route table.
|
|
WaypointCount int64 `gorm:"column:waypoint_count;->" json:"waypointCount"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
|
|
}
|
|
|
|
func (Route) TableName() string {
|
|
return "route"
|
|
}
|
|
|
|
// RouteWaypoint 航线航点
|
|
type RouteWaypoint struct {
|
|
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
|
|
RouteID int64 `gorm:"column:route_id;type:BIGINT;not null;uniqueIndex:uk_route_seq" json:"routeId"`
|
|
Seq int `gorm:"column:seq;type:INT;not null;uniqueIndex:uk_route_seq" json:"seq"`
|
|
Longitude float64 `gorm:"column:longitude;type:DOUBLE" json:"longitude"`
|
|
Latitude float64 `gorm:"column:latitude;type:DOUBLE" json:"latitude"`
|
|
Altitude float64 `gorm:"column:altitude;type:DOUBLE" json:"altitude"`
|
|
Speed float64 `gorm:"column:speed;type:DOUBLE" json:"speed"`
|
|
Yaw float64 `gorm:"column:yaw;type:DOUBLE" json:"yaw"`
|
|
HoldSec int `gorm:"column:hold_sec;type:INT;default:0" json:"holdSec"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
}
|
|
|
|
func (RouteWaypoint) TableName() string {
|
|
return "route_waypoint"
|
|
}
|
|
|