models

package
v0.0.0-...-9b663ca Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	base.DefaultModel
	DeviceID         uint `gorm:"uniqueIndex:attribute_uix"`
	AttributeModelID uint `gorm:"uniqueIndex:attribute_uix"`
	AttributeModel   AttributeModel
	Value            string `gorm:"size:50;NOT NULL;"`
}

Attribute 属性

func NewAttribute

func NewAttribute() *Attribute

NewAttribute ..

func (*Attribute) TableName

func (m *Attribute) TableName() string

TableName ..

type AttributeModel

type AttributeModel struct {
	base.DefaultModel
	DeviceModelID uint   `gorm:"uniqueIndex:attribute_model_uix"`
	Key           string `gorm:"uniqueIndex:attribute_model_uix;size:50"`
	Name          string `gorm:"size:50"`
}

AttributeModel 属性模型

func NewAttributeModel

func NewAttributeModel() *AttributeModel

NewAttributeModel ..

func NewAttributeModelFromPB

func NewAttributeModelFromPB(in *pb.CreateAttributeModelRequest) *AttributeModel

NewAttributeModelFromPB ..

type CameraTimeLapseVideo

type CameraTimeLapseVideo struct {
	base.DefaultModel
	DeviceID uint
	Date     string `gorm:"size:20"`
	VideoURL string `gorm:"size:100"`
}

CameraTimeLapseVideo 摄像头延时视频,定时每1分钟抓拍图片,第二天1点合成视频

func NewCameraTimeLapseVideo

func NewCameraTimeLapseVideo() *CameraTimeLapseVideo

NewCameraTimeLapseVideo ..

func (*CameraTimeLapseVideo) ToCameraTimeLapseVideoPBs

func (m *CameraTimeLapseVideo) ToCameraTimeLapseVideoPBs(data []*CameraTimeLapseVideo,
	scheme string) []*pb.CameraTimeLapseVideo

ToCameraTimeLapseVideoPBs ..

type Device

type Device struct {
	base.DefaultModel
	DeviceModelID uint
	DeviceModel   DeviceModel
	Name          string `gorm:"size:50;NOT NULL;"`
	IP            string `gorm:"size:50;NOT NULL;"`
	AccessKey     string `gorm:"size:12;NOT NULL;"` //设备key hashid(id,16)
	SecretKey     string `gorm:"size:32;NOT NULL;"` //设备访问密钥,randString()
	Port          uint16
	Username      string       `gorm:"size:32;"`
	Password      string       `gorm:"size:32;"`
	Attributes    []*Attribute //属性,由采集程序启动时注册
	Telemetries   []*Telemetry //遥测,由采集程序按一定频率上传
}

Device 设备

func NewDevice

func NewDevice() *Device

NewDevice ..

func NewDeviceFromPB

func NewDeviceFromPB(in *pb.CreateDeviceRequest) *Device

NewDeviceFromPB ..

func (*Device) GetByID

func (m *Device) GetByID(id uint) error

GetByID ..

func (*Device) SaveAttributesFromAttributeModels

func (m *Device) SaveAttributesFromAttributeModels(
	attributeModels []*AttributeModel) (err error)

SaveAttributesFromAttributeModels ..

func (*Device) SaveTelemetriesFromTelemetryModels

func (m *Device) SaveTelemetriesFromTelemetryModels(
	telemetryModels []*TelemetryModel) (err error)

SaveTelemetriesFromTelemetryModels ..

func (*Device) SelectDeviceType

func (m *Device) SelectDeviceType(deviceType int64)

SelectDeviceType ..

func (*Device) TableName

func (m *Device) TableName() string

TableName ..

func (*Device) ToDevicePBs

func (m *Device) ToDevicePBs(data []*Device) []*pb.Device

ToDevicePBs ..

type DeviceDashboard

type DeviceDashboard struct {
	base.DefaultModel
	Name        string `gorm:"size:50"`
	IsVisible   bool
	DeviceType  uint8 //设备类型,0:默认设备,1:摄像头
	Telemetries []*DeviceDashboardTelemetry
	Cameras     []*DeviceDashboardCamera
}

DeviceDashboard 设备仪表盘

func NewDeviceDashboard

func NewDeviceDashboard() *DeviceDashboard

NewDeviceDashboard ..

func NewDeviceDashboardFromPB

func NewDeviceDashboardFromPB(in *pb.CreateDeviceDashboardRequest) *DeviceDashboard

NewDeviceDashboardFromPB ..

func (*DeviceDashboard) GetByID

func (m *DeviceDashboard) GetByID(id uint) error

GetByID ..

func (*DeviceDashboard) ToDeviceDashboardPBs

func (m *DeviceDashboard) ToDeviceDashboardPBs(data []*DeviceDashboard) []*pb.DeviceDashboard

ToDeviceDashboardPBs ..

type DeviceDashboardCamera

type DeviceDashboardCamera struct {
	base.DefaultModel
	DeviceDashboardID uint
	DeviceID          uint
	Device            Device
}

DeviceDashboardCamera 仪表盘摄像头

func NewDeviceDashboardCamera

func NewDeviceDashboardCamera() *DeviceDashboardCamera

NewDeviceDashboardCamera ..

type DeviceDashboardTelemetry

type DeviceDashboardTelemetry struct {
	base.DefaultModel
	DeviceDashboardID uint
	TelemetryID       uint
	Telemetry         Telemetry
}

DeviceDashboardTelemetry 仪表盘遥测

func NewDeviceDashboardTelemetry

func NewDeviceDashboardTelemetry() *DeviceDashboardTelemetry

NewDeviceDashboardTelemetry ..

type DeviceModel

type DeviceModel struct {
	base.DefaultModel
	Name            string `gorm:"size:50"`
	Desc            string `gorm:"size:5000"`
	DeviceType      uint8  //设备类型,0:默认设备,1:摄像头
	CameraCompany   uint8  //摄像头厂家,0:海康威视,1:大华
	AttributeModels []*AttributeModel
	TelemetryModels []*TelemetryModel
}

DeviceModel 设备模型

func NewDeviceModel

func NewDeviceModel() *DeviceModel

NewDeviceModel ..

func NewDeviceModelFromPB

func NewDeviceModelFromPB(in *pb.CreateDeviceModelRequest) *DeviceModel

NewDeviceModelFromPB ..

func (*DeviceModel) GetByID

func (m *DeviceModel) GetByID(id uint) error

GetByID ..

func (*DeviceModel) IsHikivisionCamera

func (m *DeviceModel) IsHikivisionCamera(deviceType pb.DeviceType, cameraCompany pb.CameraCompany) bool

IsHikivisionCamera ..

func (*DeviceModel) TableName

func (m *DeviceModel) TableName() string

TableName ..

func (*DeviceModel) ToDeviceModelPBs

func (m *DeviceModel) ToDeviceModelPBs(data []*DeviceModel) []*pb.DeviceModel

ToDeviceModelPBs ..

type Telemetry

type Telemetry struct {
	base.DefaultModel
	DeviceID         uint `gorm:"uniqueIndex:telemetry_uix"`
	Device           Device
	TelemetryModelID uint `gorm:"uniqueIndex:telemetry_uix"`
	TelemetryModel   TelemetryModel
}

Telemetry 遥测

func NewTelemetry

func NewTelemetry() *Telemetry

NewTelemetry ..

func (*Telemetry) TableName

func (m *Telemetry) TableName() string

TableName ..

type TelemetryModel

type TelemetryModel struct {
	base.DefaultModel
	DeviceModelID uint   `gorm:"uniqueIndex:telemetry_model_uix"`
	Key           string `gorm:"uniqueIndex:telemetry_model_uix;size:50"`
	Name          string `gorm:"size:50"`
	Factor        float64
	Unit          string `gorm:"size:10"`
	UnitName      string `gorm:"size:10"`
	Scale         uint8
}

TelemetryModel 遥测模型

func NewTelemetryModel

func NewTelemetryModel() *TelemetryModel

NewTelemetryModel ..

func NewTelemetryModelFromPB

func NewTelemetryModelFromPB(in *pb.CreateTelemetryModelRequest) *TelemetryModel

NewTelemetryModelFromPB ..

Jump to

Keyboard shortcuts

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