siteAlarmSnapshot.go 742 B

12345678910111213141516171819202122232425
  1. package model_pgsql
  2. import (
  3. "fwh-toolbox-server/database"
  4. "time"
  5. "gorm.io/datatypes"
  6. )
  7. var db = database.PgSQL
  8. // 保存快照文件数据
  9. type SiteAlarmSnapshotModel struct {
  10. ID int64 `gorm:"primaryKey;autoIncrement;comment:"` // 自增ID
  11. SN string `gorm:"size:64;not null;uniqueIndex:idx_type_sn_time"`
  12. FileRecordID int64 `gorm:"not null"`
  13. LogTime time.Time `gorm:"type:timestamp;not null;uniqueIndex:idx_type_sn_time"` // TIMESTAMP WITHOUT TIME ZONE
  14. JsonData datatypes.JSON `gorm:"type:jsonb"`
  15. }
  16. // 记录已处理过的文件(避免重复处理)
  17. type SiteAlarmSnapshotFileRecord struct {
  18. ID int64 `gorm:"primaryKey"` // 使用雪花ID算法
  19. State int16
  20. }