mirror of
https://github.com/gowvp/gb28181.git
synced 2026-04-22 15:07:10 +08:00
52 lines
2.1 KiB
Go
Executable File
52 lines
2.1 KiB
Go
Executable File
// Code generated by godddx, DO AVOID EDIT.
|
|
package ipc
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/gowvp/owl/internal/core/bz"
|
|
"github.com/ixugo/goddd/pkg/orm"
|
|
)
|
|
|
|
// Channel domain model
|
|
type Channel struct {
|
|
ID string `gorm:"primaryKey" json:"id"`
|
|
DID string `gorm:"column:did;index;notNull;default:'';comment:父级 ID" json:"did"`
|
|
DeviceID string `gorm:"column:device_id;index;notNull;default:'';comment:国标编码" json:"device_id"` // 国标编码
|
|
ChannelID string `gorm:"column:channel_id;index;notNull;default:'';comment:国标编码" json:"channel_id"` // 国标编码
|
|
Name string `gorm:"column:name;notNull;default:'';comment:通道名称" json:"name"` // 通道名称
|
|
PTZType int `gorm:"column:ptztype;notNull;default:0;comment:云台类型" json:"ptztype"` // 云台类型
|
|
IsOnline bool `gorm:"column:is_online;notNull;default:FALSE;comment:是否在线" json:"is_online"` // 是否在线
|
|
IsPlaying bool `gorm:"column:is_playing;notNull;default:FALSE;comment:是否播放中" json:"is_playing"` // 是否播放中
|
|
Ext DeviceExt `gorm:"column:ext;notNull;default:'{}';type:jsonb" json:"ext"`
|
|
CreatedAt orm.Time `gorm:"column:created_at;notNull;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
|
UpdatedAt orm.Time `gorm:"column:updated_at;notNull;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
|
Type string `gorm:"column:type;notNull;default:'';comment:通道类型" json:"type"` // 通道类型,继承父级设备类型
|
|
}
|
|
|
|
// TableName database table name
|
|
func (*Channel) TableName() string {
|
|
return "channels"
|
|
}
|
|
|
|
// 实现 port.Channel 接口
|
|
func (c *Channel) GetID() string {
|
|
return c.ID
|
|
}
|
|
|
|
func (c *Channel) GetChannelID() string {
|
|
return c.ChannelID
|
|
}
|
|
|
|
func (c *Channel) GetGB28181DeviceID() string {
|
|
return c.DeviceID
|
|
}
|
|
|
|
func (c *Channel) IsOnvif() bool {
|
|
return c.Type == TypeOnvif || bz.IsOnvif(c.ID)
|
|
}
|
|
|
|
func (c *Channel) IsGB28181() bool {
|
|
return strings.HasPrefix(c.ID, bz.IDPrefixGBChannel) || c.Type == TypeGB28181 || c.Type == ""
|
|
}
|