gb28181

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Code generated by gowebx, DO AVOID EDIT.

Code generated by gowebx, DO AVOID EDIT.

Code generated by gowebx, DO AVOID EDIT.

Code generated by gowebx, DO AVOID EDIT.

Code generated by gowebx, DO AVOID EDIT.

Code generated by gowebx, DO AVOID EDIT.

Code generated by gowebx, DO AVOID EDIT.

Code generated by gowebx, DO AVOID EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddChannelInput

type AddChannelInput struct {
	DeviceID string    `json:"device_id"` // 国标编码
	Name     string    `json:"name"`      // 通道名称
	PTZType  int       `json:"ptztype"`   // 云台类型
	IsOnline bool      `json:"is_online"` // 是否在线
	Ext      DeviceExt `json:"ext"`
}

type AddDeviceInput

type AddDeviceInput struct {
	DeviceID string `json:"device_id"` // 20 位国标编号
	Name     string `json:"name"`      // 设备名称
	Password string `json:"password"`  // 注册密码

}

type Channel

type Channel struct {
	ID        string    `gorm:"primaryKey" json:"id"`
	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"`      // 是否在线
	Ext       DeviceExt `gorm:"column:ext;notNull;default:'{}';type:jsonb" json:"ext"`
}

Channel domain model

func (*Channel) TableName

func (*Channel) TableName() string

TableName database table name

type ChannelStorer

ChannelStorer Instantiation interface

type Core

type Core struct {
	// contains filtered or unexported fields
}

Core business domain

func NewCore

func NewCore(store Storer, uni uniqueid.Core) Core

NewCore create business domain

func (*Core) AddChannel

func (c *Core) AddChannel(ctx context.Context, in *AddChannelInput) (*Channel, error)

AddChannel Insert into database

func (Core) AddDevice

func (c Core) AddDevice(ctx context.Context, in *AddDeviceInput) (*Device, error)

AddDevice Insert into database

func (*Core) DelChannel

func (c *Core) DelChannel(ctx context.Context, id string) (*Channel, error)

DelChannel Delete object

func (Core) DelDevice

func (c Core) DelDevice(ctx context.Context, id string) (*Device, error)

DelDevice Delete object

func (*Core) EditChannel

func (c *Core) EditChannel(ctx context.Context, in *EditChannelInput, id string) (*Channel, error)

EditChannel Update object information

func (Core) EditDevice

func (c Core) EditDevice(ctx context.Context, in *EditDeviceInput, id string) (*Device, error)

EditDevice Update object information

func (*Core) FindChannel

func (c *Core) FindChannel(ctx context.Context, in *FindChannelInput) ([]*Channel, int64, error)

FindChannel Paginated search

func (Core) FindDevice

func (c Core) FindDevice(ctx context.Context, in *FindDeviceInput) ([]*Device, int64, error)

FindDevice Paginated search

func (*Core) GetChannel

func (c *Core) GetChannel(ctx context.Context, id string) (*Channel, error)

GetChannel Query a single object

func (Core) GetDevice

func (c Core) GetDevice(ctx context.Context, id string) (*Device, error)

GetDevice Query a single object

func (Core) GetDeviceByDeviceID

func (c Core) GetDeviceByDeviceID(ctx context.Context, deviceID string) (*Device, error)

type Device

type Device struct {
	ID           string    `gorm:"primaryKey" json:"id"`
	DeviceID     string    `gorm:"column:device_id;notNull;uniqueIndex;default:'';comment:20 位国标编号" json:"device_id"`                          // 20 位国标编号
	Name         string    `gorm:"column:name;notNull;default:'';comment:设备名称" json:"name"`                                                    // 设备名称
	Trasnport    string    `gorm:"column:trasnport;notNull;default:'';comment:传输协议(tcp/udp)" json:"trasnport"`                                 // 传输协议(TCP/UDP)
	StreamMode   int8      `gorm:"column:stream_mode;notNull;default:0;comment:数据传输模式(0:UDP; 1:TCP_PASSIVE; 2:TCP_ACTIVE)" json:"stream_mode"` // 数据传输模式
	IP           string    `gorm:"column:ip;notNull;default:''" json:"ip"`
	Port         int       `gorm:"column:port;notNull;default:0" json:"port"`
	IsOnline     bool      `gorm:"column:is_online;notNull;default:FALSE" json:"is_online"`
	RegisteredAt orm.Time  `gorm:"column:registered_at;notNull;default:CURRENT_TIMESTAMP;comment:注册时间" json:"registered_at"` // 注册时间
	KeepaliveAt  orm.Time  `gorm:"column:keepalive_at;notNull;default:CURRENT_TIMESTAMP;comment:心跳时间" json:"keepalive_at"`   // 心跳时间
	Keepalives   int       `gorm:"column:keepalives;notNull;default:0;comment:心跳间隔" json:"keepalives"`                       // 心跳间隔
	Expires      int       `gorm:"column:expires;notNull;default:0;comment:注册有效期" json:"expires"`                            // 注册有效期
	Channels     int       `gorm:"column:channels;notNull;default:0;comment:通道数量" json:"channels"`                           // 通道数量
	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"`       // 更新时间
	Password     string    `gorm:"column:password;notNull;default:'';comment:注册密码" json:"password"`
	Address      string    `gorm:"column:address;notNull;default:'';comment:设备网络地址" json:"address"`
	Ext          DeviceExt `gorm:"column:ext;notNull;default:'{}';type:jsonb;comment:设备属性" json:"ext"` // 设备属性
}

Device domain model

func (Device) Check

func (d Device) Check() error

func (*Device) NetworkAddress

func (d *Device) NetworkAddress() string

func (*Device) TableName

func (*Device) TableName() string

TableName database table name

type DeviceExt

type DeviceExt struct {
	Manufacturer string `json:"manufacturer"` // 生产厂商
	Model        string `json:"model"`        // 型号
	Firmware     string `json:"firmware"`     // 固件版本
	Name         string `json:"name"`         // 设备名
}

DeviceExt domain model

func (*DeviceExt) Scan

func (i *DeviceExt) Scan(input interface{}) error

Scan implements orm.Scaner.

func (DeviceExt) Value

func (i DeviceExt) Value() (driver.Value, error)

type DeviceStorer

DeviceStorer Instantiation interface

type EditChannelInput

type EditChannelInput struct {
	DeviceID string    `json:"device_id"` // 国标编码
	Name     string    `json:"name"`      // 通道名称
	PTZType  int       `json:"ptztype"`   // 云台类型
	IsOnline bool      `json:"is_online"` // 是否在线
	Ext      DeviceExt `json:"ext"`
}

type EditDeviceInput

type EditDeviceInput struct {
	DeviceID   string `json:"device_id"`   // 20 位国标编号
	Name       string `json:"name"`        // 设备名称
	Password   string `json:"password"`    // 注册密码
	StreamMode int    `json:"stream_mode"` // 数据传输模式

}

type FindChannelInput

type FindChannelInput struct {
	web.PagerFilter
	DeviceID string `form:"device_id"` // 国标编码
	Key      string `form:"key"`       // 名称/国标编码 模糊搜索,id 精确搜索
	// Name     string    `form:"name"`      // 通道名称
	// PTZType  int       `form:"ptztype"`   // 云台类型
	IsOnline bool `form:"is_online"` // 是否在线
}

type FindDeviceInput

type FindDeviceInput struct {
	web.PagerFilter
	Key string `form:"key"`
}

type GB28181

type GB28181 struct {
	// contains filtered or unexported fields
}

func NewGB28181

func NewGB28181(ds DeviceStorer, cs ChannelStorer, uni uniqueid.Core) GB28181

func (GB28181) Edit

func (g GB28181) Edit(deviceID string, changeFn func(*Device)) error

func (GB28181) FindDevices

func (g GB28181) FindDevices(ctx context.Context) ([]*Device, error)

FindDevices 获取所有设备

func (GB28181) GetDeviceByDeviceID

func (g GB28181) GetDeviceByDeviceID(deviceID string) (*Device, error)

func (GB28181) Login

func (g GB28181) Login(deviceID string, changeFn func(*Device)) error

func (GB28181) Logout

func (g GB28181) Logout(deviceID string, changeFn func(*Device)) error

func (GB28181) SaveChannels

func (g GB28181) SaveChannels(channels []*Channel) error

type Storer

type Storer interface {
	Device() DeviceStorer
	Channel() ChannelStorer
}

Storer data persistence

Directories

Path Synopsis
store
gb28181db
Code generated by gowebx, DO AVOID EDIT.
Code generated by gowebx, DO AVOID EDIT.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL