relationDB

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate() error

func SceneInfoPoToDo

func SceneInfoPoToDo(info *RuleSceneInfo) *scene.Info

func SceneInfoPoToDos

func SceneInfoPoToDos(info []*RuleSceneInfo) (ret scene.Infos)

Types

type AlarmDealRecordFilter

type AlarmDealRecordFilter struct {
	AlarmRecordID int64 //告警配置ID
	Time          def.TimeRange
}

type AlarmDealRecordRepo

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

func NewAlarmDealRecordRepo

func NewAlarmDealRecordRepo(in any) *AlarmDealRecordRepo

func (AlarmDealRecordRepo) CountByFilter

func (p AlarmDealRecordRepo) CountByFilter(ctx context.Context, f AlarmDealRecordFilter) (size int64, err error)

func (AlarmDealRecordRepo) Delete

func (p AlarmDealRecordRepo) Delete(ctx context.Context, id int64) error

func (AlarmDealRecordRepo) DeleteByFilter

func (AlarmDealRecordRepo) FindByFilter

func (AlarmDealRecordRepo) FindOne

func (AlarmDealRecordRepo) FindOneByFilter

func (AlarmDealRecordRepo) Insert

func (AlarmDealRecordRepo) MultiInsert

func (p AlarmDealRecordRepo) MultiInsert(ctx context.Context, data []*RuleAlarmDealRecord) error

批量插入 LightStrategyDevice 记录

func (AlarmDealRecordRepo) Update

type AlarmInfoFilter

type AlarmInfoFilter struct {
	Name     string //名字
	SceneID  int64  // 场景ID
	AlarmIDs []int64
}

type AlarmInfoRepo

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

func NewAlarmInfoRepo

func NewAlarmInfoRepo(in any) *AlarmInfoRepo

func (AlarmInfoRepo) CountByFilter

func (p AlarmInfoRepo) CountByFilter(ctx context.Context, f AlarmInfoFilter) (size int64, err error)

func (AlarmInfoRepo) Delete

func (p AlarmInfoRepo) Delete(ctx context.Context, id int64) error

func (AlarmInfoRepo) DeleteByFilter

func (p AlarmInfoRepo) DeleteByFilter(ctx context.Context, f AlarmInfoFilter) error

func (AlarmInfoRepo) FindByFilter

func (p AlarmInfoRepo) FindByFilter(ctx context.Context, f AlarmInfoFilter, page *def.PageInfo) ([]*RuleAlarmInfo, error)

func (AlarmInfoRepo) FindOne

func (p AlarmInfoRepo) FindOne(ctx context.Context, id int64) (*RuleAlarmInfo, error)

func (AlarmInfoRepo) FindOneByFilter

func (p AlarmInfoRepo) FindOneByFilter(ctx context.Context, f AlarmInfoFilter) (*RuleAlarmInfo, error)

func (AlarmInfoRepo) Insert

func (p AlarmInfoRepo) Insert(ctx context.Context, data *RuleAlarmInfo) error

func (AlarmInfoRepo) MultiInsert

func (p AlarmInfoRepo) MultiInsert(ctx context.Context, data []*RuleAlarmInfo) error

批量插入 LightStrategyDevice 记录

func (AlarmInfoRepo) Update

func (p AlarmInfoRepo) Update(ctx context.Context, data *RuleAlarmInfo) error

type AlarmLogFilter

type AlarmLogFilter struct {
	AlarmRecordID int64 //告警配置ID
	Time          def.TimeRange
}

type AlarmLogRepo

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

func NewAlarmLogRepo

func NewAlarmLogRepo(in any) *AlarmLogRepo

func (AlarmLogRepo) CountByFilter

func (p AlarmLogRepo) CountByFilter(ctx context.Context, f AlarmLogFilter) (size int64, err error)

func (AlarmLogRepo) Delete

func (p AlarmLogRepo) Delete(ctx context.Context, id int64) error

func (AlarmLogRepo) DeleteByFilter

func (p AlarmLogRepo) DeleteByFilter(ctx context.Context, f AlarmLogFilter) error

func (AlarmLogRepo) FindByFilter

func (p AlarmLogRepo) FindByFilter(ctx context.Context, f AlarmLogFilter, page *def.PageInfo) ([]*RuleAlarmLog, error)

func (AlarmLogRepo) FindOne

func (p AlarmLogRepo) FindOne(ctx context.Context, id int64) (*RuleAlarmLog, error)

func (AlarmLogRepo) FindOneByFilter

func (p AlarmLogRepo) FindOneByFilter(ctx context.Context, f AlarmLogFilter) (*RuleAlarmLog, error)

func (AlarmLogRepo) Insert

func (p AlarmLogRepo) Insert(ctx context.Context, data *RuleAlarmLog) error

func (AlarmLogRepo) MultiInsert

func (p AlarmLogRepo) MultiInsert(ctx context.Context, data []*RuleAlarmLog) error

批量插入 LightStrategyDevice 记录

func (AlarmLogRepo) Update

func (p AlarmLogRepo) Update(ctx context.Context, data *RuleAlarmLog) error

type AlarmRecordFilter

type AlarmRecordFilter struct {
	AlarmID     int64 // 告警配置ID
	TriggerType int64
	ProductID   string
	DeviceName  string
	Time        def.TimeRange
}

type AlarmRecordRepo

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

func NewAlarmRecordRepo

func NewAlarmRecordRepo(in any) *AlarmRecordRepo

func (AlarmRecordRepo) CountByFilter

func (p AlarmRecordRepo) CountByFilter(ctx context.Context, f AlarmRecordFilter) (size int64, err error)

func (AlarmRecordRepo) Delete

func (p AlarmRecordRepo) Delete(ctx context.Context, id int64) error

func (AlarmRecordRepo) DeleteByFilter

func (p AlarmRecordRepo) DeleteByFilter(ctx context.Context, f AlarmRecordFilter) error

func (AlarmRecordRepo) FindByFilter

func (p AlarmRecordRepo) FindByFilter(ctx context.Context, f AlarmRecordFilter, page *def.PageInfo) ([]*RuleAlarmRecord, error)

func (AlarmRecordRepo) FindOne

func (p AlarmRecordRepo) FindOne(ctx context.Context, id int64) (*RuleAlarmRecord, error)

func (AlarmRecordRepo) FindOneByFilter

func (p AlarmRecordRepo) FindOneByFilter(ctx context.Context, f AlarmRecordFilter) (*RuleAlarmRecord, error)

func (AlarmRecordRepo) Insert

func (p AlarmRecordRepo) Insert(ctx context.Context, data *RuleAlarmRecord) error

func (AlarmRecordRepo) MultiInsert

func (p AlarmRecordRepo) MultiInsert(ctx context.Context, data []*RuleAlarmRecord) error

批量插入 LightStrategyDevice 记录

func (AlarmRecordRepo) Update

func (p AlarmRecordRepo) Update(ctx context.Context, data *RuleAlarmRecord) error

type AlarmSceneFilter

type AlarmSceneFilter struct {
	AlarmID int64 // 告警配置ID
	SceneID int64 // 场景ID
}

type AlarmSceneRepo

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

func NewAlarmSceneRepo

func NewAlarmSceneRepo(in any) *AlarmSceneRepo

func (AlarmSceneRepo) CountByFilter

func (p AlarmSceneRepo) CountByFilter(ctx context.Context, f AlarmSceneFilter) (size int64, err error)

func (AlarmSceneRepo) Delete

func (p AlarmSceneRepo) Delete(ctx context.Context, id int64) error

func (AlarmSceneRepo) DeleteByFilter

func (p AlarmSceneRepo) DeleteByFilter(ctx context.Context, f AlarmSceneFilter) error

func (AlarmSceneRepo) FindByFilter

func (p AlarmSceneRepo) FindByFilter(ctx context.Context, f AlarmSceneFilter, page *def.PageInfo) ([]*RuleAlarmScene, error)

func (AlarmSceneRepo) FindOne

func (p AlarmSceneRepo) FindOne(ctx context.Context, id int64) (*RuleAlarmScene, error)

func (AlarmSceneRepo) FindOneByFilter

func (p AlarmSceneRepo) FindOneByFilter(ctx context.Context, f AlarmSceneFilter) (*RuleAlarmScene, error)

func (AlarmSceneRepo) Insert

func (p AlarmSceneRepo) Insert(ctx context.Context, data *RuleAlarmScene) error

func (AlarmSceneRepo) MultiInsert

func (p AlarmSceneRepo) MultiInsert(ctx context.Context, alarmID int64, sceneIDs []int64) error

批量插入 LightStrategyDevice 记录

func (AlarmSceneRepo) Update

func (p AlarmSceneRepo) Update(ctx context.Context, data *RuleAlarmScene) error

type ExampleFilter

type ExampleFilter struct {
}

type ExampleRepo

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

func NewExampleRepo

func NewExampleRepo(in any) *ExampleRepo

func (ExampleRepo) CountByFilter

func (p ExampleRepo) CountByFilter(ctx context.Context, f ExampleFilter) (size int64, err error)

func (ExampleRepo) Delete

func (p ExampleRepo) Delete(ctx context.Context, id int64) error

func (ExampleRepo) DeleteByFilter

func (p ExampleRepo) DeleteByFilter(ctx context.Context, f ExampleFilter) error

func (ExampleRepo) FindByFilter

func (p ExampleRepo) FindByFilter(ctx context.Context, f ExampleFilter, page *def.PageInfo) ([]*RuleExample, error)

func (ExampleRepo) FindOne

func (p ExampleRepo) FindOne(ctx context.Context, id int64) (*RuleExample, error)

func (ExampleRepo) FindOneByFilter

func (p ExampleRepo) FindOneByFilter(ctx context.Context, f ExampleFilter) (*RuleExample, error)

func (ExampleRepo) Insert

func (p ExampleRepo) Insert(ctx context.Context, data *RuleExample) error

func (ExampleRepo) MultiInsert

func (p ExampleRepo) MultiInsert(ctx context.Context, data []*RuleExample) error

批量插入 LightStrategyDevice 记录

func (ExampleRepo) Update

func (p ExampleRepo) Update(ctx context.Context, data *RuleExample) error

type RuleAlarmDealRecord

type RuleAlarmDealRecord struct {
	ID            int64     `gorm:"column:id;type:BIGINT;primary_key;AUTO_INCREMENT"`
	AlarmRecordID int64     `gorm:"column:alarm_record_id;type:BIGINT;NOT NULL"`
	Result        string    `gorm:"column:result;type:varchar(1024);NOT NULL"`
	Type          int64     `gorm:"column:type;type:SMALLINT;NOT NULL"`
	AlarmTime     time.Time `gorm:"column:alarm_time;default:CURRENT_TIMESTAMP;NOT NULL"`
	CreatedTime   time.Time `gorm:"column:created_time;default:CURRENT_TIMESTAMP;NOT NULL"`
}

告警处理记录表

func (*RuleAlarmDealRecord) TableName

func (m *RuleAlarmDealRecord) TableName() string

type RuleAlarmInfo

type RuleAlarmInfo struct {
	ID     int64  `gorm:"column:id;type:BIGINT;primary_key;AUTO_INCREMENT"`
	Name   string `gorm:"column:name;uniqueIndex;type:VARCHAR(100);NOT NULL"`
	Desc   string `gorm:"column:desc;type:VARCHAR(100);NOT NULL"`
	Level  int64  `gorm:"column:level;type:SMALLINT;NOT NULL"`   // 告警配置级别(1提醒 2一般 3严重 4紧急 5超紧急)
	Status int64  `gorm:"column:status;type:SMALLINT;default:1"` // 状态 1:启用,2:禁用
	stores.Time
}

告警配置信息表

func (*RuleAlarmInfo) TableName

func (m *RuleAlarmInfo) TableName() string

type RuleAlarmLog

type RuleAlarmLog struct {
	ID            int64     `gorm:"column:id;type:BIGINT;primary_key;AUTO_INCREMENT"`
	AlarmRecordID int64     `gorm:"column:alarm_record_id;type:BIGINT;NOT NULL"`
	Serial        string    `gorm:"column:serial;type:varchar(1024);NOT NULL"`
	SceneName     string    `gorm:"column:scene_name;type:varchar(100);NOT NULL"`
	SceneID       int64     `gorm:"column:scene_id;type:BIGINT;NOT NULL"`
	Desc          string    `gorm:"column:desc;type:varchar(1024);NOT NULL"`
	CreatedTime   time.Time `gorm:"column:created_time;default:CURRENT_TIMESTAMP;NOT NULL"`
}

告警流水详情表

func (*RuleAlarmLog) TableName

func (m *RuleAlarmLog) TableName() string

type RuleAlarmRecord

type RuleAlarmRecord struct {
	ID          int64     `gorm:"column:id;type:BIGINT;primary_key;AUTO_INCREMENT"`
	AlarmID     int64     `gorm:"column:alarm_id;type:BIGINT;NOT NULL"`
	TriggerType int64     `gorm:"column:trigger_type;uniqueIndex:tt_pi_dn;type:BIGINT;NOT NULL"`
	ProductID   string    `gorm:"column:product_id;uniqueIndex:tt_pi_dn;type:char(11);NOT NULL"`
	DeviceName  string    `gorm:"column:device_name;uniqueIndex:tt_pi_dn;type:varchar(100);NOT NULL"`
	Level       int64     `gorm:"column:level;type:SMALLINT;NOT NULL"`
	SceneName   string    `gorm:"column:scene_name;type:varchar(100);NOT NULL"`
	SceneID     int64     `gorm:"column:scene_id;type:BIGINT;NOT NULL"`
	DealState   int64     `gorm:"column:deal_state;type:SMALLINT;default:1;NOT NULL"`
	LastAlarm   time.Time `gorm:"column:last_alarm;NOT NULL"`
	CreatedTime time.Time `gorm:"column:created_time;default:CURRENT_TIMESTAMP;NOT NULL"`
}

告警记录表

func (*RuleAlarmRecord) TableName

func (m *RuleAlarmRecord) TableName() string

type RuleAlarmScene

type RuleAlarmScene struct {
	ID      int64 `gorm:"column:id;type:BIGINT;primary_key;AUTO_INCREMENT"`
	AlarmID int64 `gorm:"column:alarm_id;uniqueIndex:ai_si;type:BIGINT;NOT NULL"`
	SceneID int64 `gorm:"column:scene_id;uniqueIndex:ai_si;type:BIGINT;NOT NULL"`
	stores.Time
}

告警配置与场景关联表

func (*RuleAlarmScene) TableName

func (m *RuleAlarmScene) TableName() string

type RuleExample

type RuleExample struct {
	ID int64 `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"` // id编号
}

示例

type RuleSceneInfo

type RuleSceneInfo struct {
	ID          int64         `gorm:"column:id;type:BIGINT;primary_key;AUTO_INCREMENT"`
	Name        string        `gorm:"column:name;uniqueIndex;type:varchar(128)"`
	TriggerType string        `gorm:"column:trigger_type;index;type:varchar(24);NOT NULL"`
	Trigger     scene.Trigger `gorm:"column:trigger;type:json;serializer:json"`
	When        scene.Terms   `gorm:"column:when;type:json;serializer:json"`
	Then        scene.Actions `gorm:"column:then;type:json;serializer:json"`
	Desc        string        `gorm:"column:desc;type:varchar(512)"`
	Status      int64         `gorm:"column:status;index;type:BIGINT;default:1"`
	stores.Time
}

规则引擎-场景联动信息表

func SceneInfoDoToPo

func SceneInfoDoToPo(info *scene.Info) *RuleSceneInfo

func (*RuleSceneInfo) TableName

func (m *RuleSceneInfo) TableName() string

type SceneInfoRepo

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

func NewSceneInfoRepo

func NewSceneInfoRepo(in any) *SceneInfoRepo

func (SceneInfoRepo) CountByFilter

func (p SceneInfoRepo) CountByFilter(ctx context.Context, f scene.InfoFilter) (size int64, err error)

func (SceneInfoRepo) Delete

func (p SceneInfoRepo) Delete(ctx context.Context, id int64) error

func (SceneInfoRepo) DeleteByFilter

func (p SceneInfoRepo) DeleteByFilter(ctx context.Context, f scene.InfoFilter) error

func (SceneInfoRepo) FindByFilter

func (p SceneInfoRepo) FindByFilter(ctx context.Context, f scene.InfoFilter, page *def.PageInfo) (scene.Infos, error)

func (SceneInfoRepo) FindOne

func (p SceneInfoRepo) FindOne(ctx context.Context, id int64) (*scene.Info, error)

func (SceneInfoRepo) FindOneByFilter

func (p SceneInfoRepo) FindOneByFilter(ctx context.Context, f scene.InfoFilter) (*scene.Info, error)

func (SceneInfoRepo) FindOneByName

func (p SceneInfoRepo) FindOneByName(ctx context.Context, name string) (*scene.Info, error)

func (SceneInfoRepo) Insert

func (p SceneInfoRepo) Insert(ctx context.Context, data *scene.Info) (id int64, err error)

func (SceneInfoRepo) MultiInsert

func (p SceneInfoRepo) MultiInsert(ctx context.Context, data []*RuleSceneInfo) error

批量插入 LightStrategyDevice 记录

func (SceneInfoRepo) Update

func (p SceneInfoRepo) Update(ctx context.Context, data *scene.Info) error

Jump to

Keyboard shortcuts

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