低空智控平台 后端go
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.
 
 

84 lines
4.8 KiB

package model
import "time"
// LiveSession 直播会话
type LiveSession struct {
ID string `gorm:"primaryKey;column:id;type:VARCHAR(128);not null" json:"id"`
DockID string `gorm:"column:dock_id;type:VARCHAR(64);not null" json:"dockId"`
Provider string `gorm:"column:provider;type:VARCHAR(16);default:aliyun" json:"provider"`
StreamName string `gorm:"column:stream_name;type:VARCHAR(128);not null" json:"streamName"`
PushURLHash string `gorm:"column:push_url_hash;type:VARCHAR(128)" json:"pushUrlHash"`
ExpiresAt int64 `gorm:"column:expires_at;type:BIGINT;not null" json:"expiresAt"`
MaxBitrateBps int64 `gorm:"column:max_bitrate_bps;type:BIGINT;default:1500000" json:"maxBitrateBps"`
Phase string `gorm:"column:phase;type:VARCHAR(16);default:idle" json:"phase"`
StopReason string `gorm:"column:stop_reason;type:VARCHAR(32)" json:"stopReason"`
ErrorCode string `gorm:"column:error_code;type:VARCHAR(64)" json:"errorCode"`
RequestedBy int64 `gorm:"column:requested_by;type:BIGINT" json:"requestedBy"`
StopDeadline *time.Time `gorm:"column:stop_deadline" json:"stopDeadline"`
DeviceStateVersion int64 `gorm:"column:device_state_version;type:BIGINT" json:"deviceStateVersion"`
DeviceEventID string `gorm:"column:device_event_id;type:VARCHAR(128)" json:"deviceEventId"`
DeviceUpdatedAt int64 `gorm:"column:device_updated_at;type:BIGINT" json:"deviceUpdatedAt"`
DeviceStreaming bool `gorm:"column:device_streaming;type:TINYINT" json:"deviceStreaming"`
CloudOnline bool `gorm:"column:cloud_online;type:TINYINT" json:"cloudOnline"`
CloudCheckedAt *time.Time `gorm:"column:cloud_checked_at" json:"cloudCheckedAt"`
CloudConfirmedAt *time.Time `gorm:"column:cloud_confirmed_at" json:"cloudConfirmedAt"`
StartedAt *time.Time `gorm:"column:started_at" json:"startedAt"`
StoppedAt *time.Time `gorm:"column:stopped_at" json:"stoppedAt"`
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
}
func (LiveSession) TableName() string {
return "live_session"
}
// LiveViewerLease 表示用户对直播会话的短期观看租约。
type LiveViewerLease struct {
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
StreamSessionID string `gorm:"column:stream_session_id;type:VARCHAR(128);not null" json:"streamSessionId"`
ViewerID int64 `gorm:"column:viewer_id;type:BIGINT;not null" json:"viewerId"`
ExpiresAt time.Time `gorm:"column:expires_at;not null" json:"expiresAt"`
ReleasedAt *time.Time `gorm:"column:released_at" json:"releasedAt"`
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
}
func (LiveViewerLease) TableName() string {
return "live_viewer_lease"
}
// Video 视频文件
type Video 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)" json:"droneSn"`
ExecutionID int64 `gorm:"column:execution_id;type:BIGINT" json:"executionId"`
FileName string `gorm:"column:file_name;type:VARCHAR(256)" json:"fileName"`
FileSize int64 `gorm:"column:file_size;type:BIGINT" json:"fileSize"`
Duration int `gorm:"column:duration;type:INT" json:"duration"`
OssKey string `gorm:"column:oss_key;type:VARCHAR(256)" json:"ossKey"`
OssBucket string `gorm:"column:oss_bucket;type:VARCHAR(128)" json:"ossBucket"`
ThumbnailKey string `gorm:"column:thumbnail_key;type:VARCHAR(256)" json:"thumbnailKey"`
Status string `gorm:"column:status;type:VARCHAR(16);default:uploading" json:"status"`
UploadExpireAt *time.Time `gorm:"column:upload_expire_at" json:"uploadExpireAt"`
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
}
func (Video) TableName() string {
return "video"
}
// DownloadLog 下载记录
type DownloadLog struct {
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
VideoID int64 `gorm:"column:video_id;type:BIGINT;not null" json:"videoId"`
UserID int64 `gorm:"column:user_id;type:BIGINT;not null" json:"userId"`
Bytes int64 `gorm:"column:bytes;type:BIGINT;not null" json:"bytes"`
IdempotencyKey string `gorm:"column:idempotency_key;type:VARCHAR(128);not null;uniqueIndex:uk_download_log_idempotency" json:"idempotencyKey"`
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
}
func (DownloadLog) TableName() string {
return "download_log"
}