relationDB

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShareAuthTypeAll = 1 //授予全部权限
	ShareAuthType    = 1 //授予全部权限
)

Variables

View Source
var (
	MigrateProtocolInfo    = []DmProtocolInfo{{ID: 3, Name: "iThings标准协议", Code: "iThings", TransProtocol: "mqtt", EtcdKey: "dg.rpc"}}
	MigrateProductCategory = []DmProductCategory{
		{ID: 3, Name: "照明设备", ParentID: def.RootNode, IDPath: "3-"},
		{ID: 4, Name: "空调设备", ParentID: def.RootNode, IDPath: "4-"},
		{ID: 5, Name: "风扇设备", ParentID: def.RootNode, IDPath: "5-"},
		{ID: 6, Name: "传感器设备", ParentID: def.RootNode, IDPath: "6-"},
	}
	MigrateManufacturerInfo = []DmManufacturerInfo{
		{
			ID:    1,
			Name:  "iThings",
			Desc:  "欢迎加入",
			Phone: "166666666",
		},
	}
)
View Source
var ClearDeviceInfo func(ctx context.Context, dev devices.Core) error

Functions

func CommonToSchemaDo

func CommonToSchemaDo(in []*DmCommonSchema) *schema.Model

func Migrate

func Migrate(c conf.Database) error

func NewShadowRepo

func NewShadowRepo(in any) shadow.Repo

func ToActionDo

func ToActionDo(in *DmSchemaCore) *schema.Action

func ToAffordancePo

func ToAffordancePo(in any) string

func ToCommonParam

func ToCommonParam(in *DmSchemaCore) schema.CommonParam

func ToDeviceSchemaDo added in v1.0.4

func ToDeviceSchemaDo(productID string, in []*DmDeviceSchema) *schema.Model

func ToEventDo

func ToEventDo(in *DmSchemaCore) *schema.Event

func ToPropertyDo

func ToPropertyDo(in *DmSchemaCore) *schema.Property

func ToSchemaDo

func ToSchemaDo(productID string, in []*DmSchemaInfo) *schema.Model

func ToShadowDo

func ToShadowDo(in *DmDeviceShadow) *shadow.Info

func ToShadowsDo

func ToShadowsDo(in []*DmDeviceShadow) []*shadow.Info

Types

type CommonSchemaFilter

type CommonSchemaFilter struct {
	ID                 int64
	Type               int64 //物模型类型 1:property属性 2:event事件 3:action行为
	Types              []int64
	Identifiers        []string //过滤标识符列表
	Name               string
	IsCanSceneLinkage  int64
	ProductCategoryIDs []int64
	FuncGroup          int64
	UserPerm           int64
	PropertyMode       string
	ControlMode        int64
	ProductSceneMode   string
}

type CommonSchemaRepo

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

func NewCommonSchemaRepo

func NewCommonSchemaRepo(in any) *CommonSchemaRepo

func (CommonSchemaRepo) CountByFilter

func (p CommonSchemaRepo) CountByFilter(ctx context.Context, f CommonSchemaFilter) (size int64, err error)

func (CommonSchemaRepo) DeleteByFilter

func (p CommonSchemaRepo) DeleteByFilter(ctx context.Context, f CommonSchemaFilter) error

func (CommonSchemaRepo) FindByFilter

func (CommonSchemaRepo) FindOneByFilter

func (CommonSchemaRepo) Insert

func (p CommonSchemaRepo) Insert(ctx context.Context, data *DmCommonSchema) error

func (CommonSchemaRepo) Update

func (p CommonSchemaRepo) Update(ctx context.Context, data *DmCommonSchema) error

type DeviceFilter

type DeviceFilter struct {
	TenantCode         string
	TenantCodes        []string
	ProjectIDs         []int64
	ProductID          string
	ProductIDs         []string
	AreaIDs            []int64
	NotAreaIDs         []int64
	DeviceName         string
	DeviceNames        []string
	Tags               map[string]string
	LastLoginTime      *def.TimeRange
	IsOnline           int64
	Status             def.DeviceStatus
	Statuses           []def.DeviceStatus
	Range              int64
	Position           stores.Point
	DeviceAlias        string
	Versions           []string
	NotVersion         string
	Cores              []*devices.Core
	Gateway            *devices.Core
	Iccid              string
	WithProduct        bool
	ProductCategoryID  int64
	ProductCategoryIDs []int64
	SharedType         def.SelectType
	CollectType        def.SelectType
	WithManufacturer   bool
	DeviceType         int64
	DeviceTypes        []int64
	GroupID            int64
	ParentGroupID      int64
	GroupName          string
	GroupIDs           []int64
	UserID             int64
	UserIDs            []int64
	NotGroupID         int64
	NotAreaID          int64
	Distributor        *stores.IDPathFilter
	RatedPower         *stores.Cmp
	ExpTime            *stores.Cmp
	AreaIDPath         string
	HasOwner           int64 //是否被人拥有
	NotOtaJobID        int64
	NeedConfirmJobID   int64
	NeedConfirmVersion string
	NetType            int64
}

type DeviceInfoRepo

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

func NewDeviceInfoRepo

func NewDeviceInfoRepo(in any) *DeviceInfoRepo

func (DeviceInfoRepo) CountByFilter

func (d DeviceInfoRepo) CountByFilter(ctx context.Context, f DeviceFilter) (size int64, err error)

func (DeviceInfoRepo) CountGroupByField

func (d DeviceInfoRepo) CountGroupByField(ctx context.Context, f DeviceFilter, columnName string) (map[string]int64, error)

func (DeviceInfoRepo) Delete

func (d DeviceInfoRepo) Delete(ctx context.Context, id int64) error

func (DeviceInfoRepo) FindByFilter

func (d DeviceInfoRepo) FindByFilter(ctx context.Context, f DeviceFilter, page *stores.PageInfo) ([]*DmDeviceInfo, error)

func (DeviceInfoRepo) FindCoreByFilter

func (d DeviceInfoRepo) FindCoreByFilter(ctx context.Context, f DeviceFilter, page *stores.PageInfo) ([]devices.Core, error)

func (DeviceInfoRepo) FindOneByFilter

func (d DeviceInfoRepo) FindOneByFilter(ctx context.Context, f DeviceFilter) (*DmDeviceInfo, error)

func (DeviceInfoRepo) FindProductIDsByFilter

func (d DeviceInfoRepo) FindProductIDsByFilter(ctx context.Context, f DeviceFilter) ([]string, error)

func (DeviceInfoRepo) Insert

func (d DeviceInfoRepo) Insert(ctx context.Context, data *DmDeviceInfo) error

func (DeviceInfoRepo) MultiUpdate

func (d DeviceInfoRepo) MultiUpdate(ctx context.Context, devices []*devices.Core, info *DmDeviceInfo, columns ...string) error

func (DeviceInfoRepo) Update

func (d DeviceInfoRepo) Update(ctx context.Context, data *DmDeviceInfo) error

func (DeviceInfoRepo) UpdateOfflineStatus

func (d DeviceInfoRepo) UpdateOfflineStatus(ctx context.Context, f DeviceFilter) error

func (DeviceInfoRepo) UpdateWithField

func (d DeviceInfoRepo) UpdateWithField(ctx context.Context, f DeviceFilter, updates map[string]any) error

type DeviceModuleVersionFilter

type DeviceModuleVersionFilter struct {
	ProductID  string
	DeviceName string
	ModuleCode string
}

type DeviceModuleVersionRepo

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

func NewDeviceModuleVersionRepo

func NewDeviceModuleVersionRepo(in any) *DeviceModuleVersionRepo

func (DeviceModuleVersionRepo) CountByFilter

func (p DeviceModuleVersionRepo) CountByFilter(ctx context.Context, f DeviceModuleVersionFilter) (size int64, err error)

func (DeviceModuleVersionRepo) Delete

func (DeviceModuleVersionRepo) DeleteByFilter

func (DeviceModuleVersionRepo) FindByFilter

func (DeviceModuleVersionRepo) FindOne

func (DeviceModuleVersionRepo) FindOneByFilter

func (DeviceModuleVersionRepo) Insert

func (DeviceModuleVersionRepo) MultiInsert

批量插入 LightStrategyDevice 记录

func (DeviceModuleVersionRepo) Update

type DeviceMsgCountFilter

type DeviceMsgCountFilter struct {
}

type DeviceMsgCountRepo

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

func NewDeviceMsgCountRepo

func NewDeviceMsgCountRepo(in any) *DeviceMsgCountRepo

func (DeviceMsgCountRepo) CountByFilter

func (p DeviceMsgCountRepo) CountByFilter(ctx context.Context, f DeviceMsgCountFilter) (size int64, err error)

func (DeviceMsgCountRepo) Delete

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

func (DeviceMsgCountRepo) DeleteByFilter

func (p DeviceMsgCountRepo) DeleteByFilter(ctx context.Context, f DeviceMsgCountFilter) error

func (DeviceMsgCountRepo) FindByFilter

func (DeviceMsgCountRepo) FindOne

func (DeviceMsgCountRepo) FindOneByFilter

func (DeviceMsgCountRepo) Insert

func (DeviceMsgCountRepo) MultiInsert

func (p DeviceMsgCountRepo) MultiInsert(ctx context.Context, data []*DmDeviceMsgCount) error

批量插入 LightStrategyDevice 记录

func (DeviceMsgCountRepo) Update

func (DeviceMsgCountRepo) UpdateWithField

func (d DeviceMsgCountRepo) UpdateWithField(ctx context.Context, f DeviceMsgCountFilter, updates map[string]any) error

type DeviceProfileFilter

type DeviceProfileFilter struct {
	Codes   []string
	Code    string
	Device  devices.Core
	Devices []*devices.Core
}

type DeviceProfileRepo

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

func NewDeviceProfileRepo

func NewDeviceProfileRepo(in any) *DeviceProfileRepo

func (DeviceProfileRepo) CountByFilter

func (p DeviceProfileRepo) CountByFilter(ctx context.Context, f DeviceProfileFilter) (size int64, err error)

func (DeviceProfileRepo) Delete

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

func (DeviceProfileRepo) DeleteByFilter

func (p DeviceProfileRepo) DeleteByFilter(ctx context.Context, f DeviceProfileFilter) error

func (DeviceProfileRepo) FindByFilter

func (DeviceProfileRepo) FindOne

func (DeviceProfileRepo) FindOneByFilter

func (DeviceProfileRepo) Insert

func (p DeviceProfileRepo) Insert(ctx context.Context, data *DmDeviceProfile) error

func (DeviceProfileRepo) MultiInsert

func (p DeviceProfileRepo) MultiInsert(ctx context.Context, data []*DmDeviceProfile) error

批量插入 LightStrategyDevice 记录

func (DeviceProfileRepo) Update

func (p DeviceProfileRepo) Update(ctx context.Context, data *DmDeviceProfile) error

func (DeviceProfileRepo) UpdateWithField

func (d DeviceProfileRepo) UpdateWithField(ctx context.Context, f DeviceProfileFilter, updates map[string]any) error

type DeviceSchemaFilter added in v1.0.4

type DeviceSchemaFilter struct {
	ID                int64
	ProductID         string //产品id  必填
	DeviceName        string //设备ID
	Type              int64  //物模型类型 1:property属性 2:event事件 3:action行为
	Types             []int64
	Tag               schema.Tag //过滤条件: 物模型标签 1:自定义 2:可选 3:必选
	Tags              []schema.Tag
	Identifiers       []string //过滤标识符列表
	Name              string
	IsCanSceneLinkage int64
	FuncGroup         int64
	UserPerm          int64
	PropertyMode      string
	ControlMode       int64
	ProductSceneMode  string
	WithProductSchema bool
}

type DeviceSchemaRepo added in v1.0.4

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

func NewDeviceSchemaRepo added in v1.0.4

func NewDeviceSchemaRepo(in any) *DeviceSchemaRepo

func (DeviceSchemaRepo) CountByFilter added in v1.0.4

func (p DeviceSchemaRepo) CountByFilter(ctx context.Context, f DeviceSchemaFilter) (size int64, err error)

func (DeviceSchemaRepo) DeleteByFilter added in v1.0.4

func (p DeviceSchemaRepo) DeleteByFilter(ctx context.Context, f DeviceSchemaFilter) error

func (DeviceSchemaRepo) FindByFilter added in v1.0.4

func (DeviceSchemaRepo) FindOneByFilter added in v1.0.4

func (DeviceSchemaRepo) Insert added in v1.0.4

func (p DeviceSchemaRepo) Insert(ctx context.Context, data *DmDeviceSchema) error

func (DeviceSchemaRepo) MultiInsert added in v1.0.4

func (p DeviceSchemaRepo) MultiInsert(ctx context.Context, data []*DmDeviceSchema) error

批量插入 LightStrategyDevice 记录

func (DeviceSchemaRepo) MultiInsert2 added in v1.0.4

func (p DeviceSchemaRepo) MultiInsert2(ctx context.Context, productID string, deviceName string, schemaInfo *schema.Model) error

批量插入 LightStrategyDevice 记录

func (DeviceSchemaRepo) MultiUpdate added in v1.0.4

func (p DeviceSchemaRepo) MultiUpdate(ctx context.Context, productID string, deviceName string, schemaInfo *schema.Model) error

func (DeviceSchemaRepo) Update added in v1.0.4

func (p DeviceSchemaRepo) Update(ctx context.Context, data *DmDeviceSchema) error

func (DeviceSchemaRepo) UpdateTag added in v1.0.4

func (p DeviceSchemaRepo) UpdateTag(ctx context.Context, productIDs []string, identifiers []string, oldTag, newTag int64) error

type DmCommonSchema

type DmCommonSchema struct {
	ID int64 `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	DmSchemaCore
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:identifier"`
}

通用物模型表

func (*DmCommonSchema) TableName

func (m *DmCommonSchema) TableName() string

type DmDeviceInfo

type DmDeviceInfo struct {
	ID          int64             `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	TenantCode  stores.TenantCode `gorm:"column:tenant_code;index;type:VARCHAR(50);NOT NULL"`                              // 租户编码
	ProjectID   stores.ProjectID  `gorm:"column:project_id;index:project_id_area_id;type:bigint;default:0;NOT NULL"`       // 项目ID(雪花ID)
	AreaID      stores.AreaID     `gorm:"column:area_id;index:project_id_area_id;type:bigint;default:0;NOT NULL"`          // 项目区域ID(雪花ID)
	AreaIDPath  stores.AreaIDPath `gorm:"column:area_id_path;type:varchar(100);default:'';NOT NULL"`                       // 项目区域ID路径(雪花ID)
	ProductID   string            `gorm:"column:product_id;type:varchar(100);uniqueIndex:product_id_deviceName;NOT NULL"`  // 产品id
	DeviceName  string            `gorm:"column:device_name;uniqueIndex:product_id_deviceName;type:varchar(100);NOT NULL"` // 设备名称
	DeviceAlias string            `gorm:"column:device_alias;type:varchar(100);NOT NULL"`                                  // 设备别名
	Position    stores.Point      `gorm:"column:position;NOT NULL"`                                                        // 设备的位置(默认百度坐标系BD09)
	RatedPower  int64             `gorm:"column:rated_power;index;type:bigint;NOT NULL;default:0"`                         // 额定功率:单位w/h
	Secret      string            `gorm:"column:secret;type:varchar(50);NOT NULL"`                                         // 设备秘钥
	Cert        string            `gorm:"column:cert;type:varchar(512);NOT NULL"`                                          // 设备证书
	Imei        string            `gorm:"column:imei;type:varchar(25);NOT NULL"`                                           // IMEI号信息
	Mac         string            `gorm:"column:mac;type:varchar(17);NOT NULL"`                                            // MAC号信息
	DeviceType  int64             `gorm:"column:device_type;index;type:smallint;default:1"`                                // 设备类型:1:设备,2:网关,3:子设备
	Version     string            `gorm:"column:version;index;type:varchar(64);NOT NULL"`                                  // 固件版本
	//ModuleVersion  map[string]string `gorm:"column:module_version;type:json;serializer:json;NOT NULL;default:'{}'"`      // 所有模块的版本
	HardInfo           string            `gorm:"column:hard_info;type:varchar(64);NOT NULL"`                           // 模组硬件型号
	SoftInfo           string            `gorm:"column:soft_info;type:varchar(64);NOT NULL"`                           // 模组软件版本
	MobileOperator     int64             `gorm:"column:mobile_operator;type:smallint;default:1;NOT NULL"`              // 移动运营商:1)移动 2)联通 3)电信 4)广电
	Phone              sql.NullString    `gorm:"column:phone;type:varchar(20)"`                                        // 手机号
	Iccid              sql.NullString    `gorm:"column:iccid;type:varchar(20)"`                                        // SIM卡卡号
	Address            string            `gorm:"column:address;type:varchar(512);default:''"`                          // 所在地址
	Adcode             string            `gorm:"column:adcode;type:varchar(125);default:''"`                           // 地区编码
	Tags               map[string]string `gorm:"column:tags;type:json;serializer:json;NOT NULL;default:'{}'"`          // 设备标签
	SchemaAlias        map[string]string `gorm:"column:schema_alias;type:json;serializer:json;NOT NULL;default:'{}'"`  // 设备物模型别名,如果是结构体类型则key为xxx.xxx
	Rssi               int64             `gorm:"column:rssi;type:bigint;default:0;NOT NULL"`                           // 设备信号(信号极好[-55— 0],信号好[-70— -55],信号一般[-85— -70],信号差[-100— -85])
	ProtocolConf       map[string]string `gorm:"column:protocol_conf;type:json;serializer:json;NOT NULL;default:'{}'"` // 自定义协议配置
	IsOnline           int64             `gorm:"column:is_online;type:smallint;default:2;NOT NULL"`                    // 是否在线,1是2否
	FirstLogin         sql.NullTime      `gorm:"column:first_login"`                                                   // 激活时间
	FirstBind          sql.NullTime      `gorm:"column:first_bind"`                                                    // 首次绑定事件
	LastLogin          sql.NullTime      `gorm:"column:last_login"`                                                    // 最后上线时间
	LogLevel           int64             `gorm:"column:log_level;type:smallint;default:1;NOT NULL"`                    // 日志级别:1)关闭 2)错误 3)告警 4)信息 5)调试
	UserID             int64             `gorm:"column:user_id;type:BIGINT;default:1"`                                 // 用户id
	Status             def.DeviceStatus  `gorm:"column:status;index;type:smallint;default:1;NOT NULL"`                 // 设备状态 1-未激活,2-在线,3-离线 4-异常(频繁上下线,告警中) 5-禁用
	IsEnable           int64             `gorm:"column:is_enable;index;type:smallint;default:1;"`                      // 是否启用: 1:是 2:否
	ExpTime            sql.NullTime      `gorm:"column:exp_time"`                                                      // 过期时间,为0不限制
	NeedConfirmJobID   int64             `gorm:"column:need_confirm_job_id;type:smallint;default:0;"`                  // 需要app确认升级的任务ID,为0是没有
	NeedConfirmVersion string            `gorm:"column:need_confirm_version;type:varchar(128);default:'';"`            // 待确认升级的版本
	LastIp             string            `gorm:"column:last_ip;type:varchar(128);default:'';"`                         // 最后登录的ip地址
	stores.NoDelTime
	Desc        string                  `gorm:"column:desc;type:varchar(200)"`        // 描述
	Distributor stores.IDPathWithUpdate `gorm:"embedded;embeddedPrefix:distributor_"` // 代理的id,如果为空,则未参与分销
	DeletedTime stores.DeletedTime      `gorm:"column:deleted_time;default:0;uniqueIndex:product_id_deviceName"`
	ProductInfo *DmProductInfo          `gorm:"foreignKey:ProductID;references:ProductID"` // 添加外键
}

设备信息表

func (*DmDeviceInfo) AfterDelete

func (u *DmDeviceInfo) AfterDelete(tx *gorm.DB) (err error)

func (*DmDeviceInfo) AfterSave

func (u *DmDeviceInfo) AfterSave(tx *gorm.DB) (err error)

func (*DmDeviceInfo) TableName

func (m *DmDeviceInfo) TableName() string

type DmDeviceModuleVersion

type DmDeviceModuleVersion struct {
	ID         int64  `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	ProductID  string `gorm:"column:product_id;type:varchar(100);uniqueIndex:product_id_deviceName;NOT NULL"`  // 产品id
	DeviceName string `gorm:"column:device_name;uniqueIndex:product_id_deviceName;type:varchar(100);NOT NULL"` // 设备名称
	ModuleCode string `gorm:"column:module_code;type:varchar(64);uniqueIndex:product_id_deviceName"`           // 固件名称
	Version    string `gorm:"column:version;type:varchar(64);NOT NULL;uniqueIndex:product_id_deviceName"`      // 固件版本
	stores.NoDelTime
}

func (*DmDeviceModuleVersion) TableName

func (m *DmDeviceModuleVersion) TableName() string

type DmDeviceMsgCount

type DmDeviceMsgCount struct {
	ID   int64             `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	Type deviceLog.MsgType `gorm:"column:type;index;type:VARCHAR(50);uniqueIndex:date_type;NOT NULL"` // 消息类型
	Num  int64             `gorm:"column:num;type:bigint;default:0"`                                  //数量
	Date time.Time         `gorm:"column:date;NOT NULL;uniqueIndex:date_type"`                        //统计的日期
	stores.OnlyTime
}

设备信息表

func (*DmDeviceMsgCount) TableName

func (m *DmDeviceMsgCount) TableName() string

type DmDeviceProfile

type DmDeviceProfile struct {
	ID         int64             `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	TenantCode stores.TenantCode `gorm:"column:tenant_code;type:VARCHAR(50);NOT NULL;uniqueIndex:tc_un;"` // 租户编码
	ProductID  string            `gorm:"column:product_id;type:varchar(100);uniqueIndex:tc_un;NOT NULL"`  // 产品id
	DeviceName string            `gorm:"column:device_name;uniqueIndex:tc_un;type:varchar(100);NOT NULL"` // 设备名称
	Code       string            `gorm:"column:code;type:VARCHAR(50);uniqueIndex:tc_un;NOT NULL"`         //配置code
	Params     string            `gorm:"column:params;type:text;NOT NULL"`
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:tc_un;"`
}

用户配置表

func (*DmDeviceProfile) TableName

func (m *DmDeviceProfile) TableName() string

type DmDeviceSchema added in v1.0.2

type DmDeviceSchema struct {
	ID         int64  `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	ProductID  string `gorm:"column:product_id;uniqueIndex:identifier;index:product_id_type;type:varchar(100);NOT NULL"`      // 产品id
	DeviceName string `gorm:"column:device_name;uniqueIndex:identifier;index:product_id_type;type:varchar(100);default:null"` // 产品id
	DmSchemaCore
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:identifier"`
}

产品物模型表

func (*DmDeviceSchema) TableName added in v1.0.2

func (m *DmDeviceSchema) TableName() string

type DmDeviceShadow

type DmDeviceShadow struct {
	ID                int64        `gorm:"column:id;type:BIGINT;primary_key;AUTO_INCREMENT"`
	ProductID         string       `gorm:"column:product_id;uniqueIndex:pi_dn_di;type:varchar(100);NOT NULL"`
	DeviceName        string       `gorm:"column:device_name;uniqueIndex:pi_dn_di;type:VARCHAR(100);NOT NULL"`
	DataID            string       `gorm:"column:data_id;uniqueIndex:pi_dn_di;type:VARCHAR(100);NOT NULL"`
	Value             string       `gorm:"column:value;type:VARCHAR(100);default:NULL"`
	UpdatedDeviceTime sql.NullTime `gorm:"column:updated_device_time;"`
	stores.OnlyTime
}

设备影子表

func ToShadowPo

func ToShadowPo(info *shadow.Info) *DmDeviceShadow

func (*DmDeviceShadow) TableName

func (m *DmDeviceShadow) TableName() string

type DmExample

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

type DmGatewayDevice

type DmGatewayDevice struct {
	ID                int64  `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	GatewayProductID  string `gorm:"column:gateway_product_id;type:varchar(100);NOT NULL"`                    // 网关产品id
	GatewayDeviceName string `gorm:"column:gateway_device_name;type:varchar(100);NOT NULL"`                   // 网关设备名称
	ProductID         string `gorm:"column:product_id;uniqueIndex:gpi_pdn_pi_dn;type:varchar(100);NOT NULL"`  // 子设备产品id
	DeviceName        string `gorm:"column:device_name;uniqueIndex:gpi_pdn_pi_dn;type:varchar(100);NOT NULL"` // 子设备名称
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:gpi_pdn_pi_dn"`
	Device      *DmDeviceInfo      `gorm:"foreignKey:ProductID,DeviceName;references:ProductID,DeviceName"`
	Gateway     *DmDeviceInfo      `gorm:"foreignKey:ProductID,DeviceName;references:GatewayProductID,GatewayDeviceName"`
}

网关与子设备关系表

func (*DmGatewayDevice) TableName

func (m *DmGatewayDevice) TableName() string

type DmGroupDevice

type DmGroupDevice struct {
	ID         int64             `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	TenantCode stores.TenantCode `gorm:"column:tenant_code;index;type:VARCHAR(50);NOT NULL"`                                        // 租户编码
	ProjectID  stores.ProjectID  `gorm:"column:project_id;index;type:bigint;default:0;NOT NULL"`                                    // 项目ID(雪花ID)
	AreaID     stores.AreaID     `gorm:"column:area_id;index:project_id_area_id;type:bigint;default:0;NOT NULL"`                    // 项目区域ID(雪花ID)
	GroupID    int64             `gorm:"column:group_id;uniqueIndex:group_id_product_id_device_name;type:bigint;NOT NULL"`          // 分组ID
	ProductID  string            `gorm:"column:product_id;uniqueIndex:group_id_product_id_device_name;type:varchar(100);NOT NULL"`  // 产品id
	DeviceName string            `gorm:"column:device_name;uniqueIndex:group_id_product_id_device_name;type:varchar(100);NOT NULL"` // 设备名称
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:group_id_product_id_device_name"`
	ProductInfo *DmProductInfo     `gorm:"foreignKey:ProductID;references:ProductID"`
	Device      *DmDeviceInfo      `gorm:"foreignKey:ProductID,DeviceName;references:ProductID,DeviceName"`
}

分组与设备关系表

func (*DmGroupDevice) TableName

func (m *DmGroupDevice) TableName() string

type DmGroupInfo

type DmGroupInfo struct {
	ID         int64             `gorm:"column:id;primary_key;AUTO_INCREMENT;type:bigint"`                               // 分组ID
	TenantCode stores.TenantCode `gorm:"column:tenant_code;uniqueIndex:tc_ac;default:default;type:VARCHAR(50);NOT NULL"` // 租户编码
	ProjectID  stores.ProjectID  `gorm:"column:project_id;uniqueIndex:tc_ac;type:bigint;default:2;NOT NULL"`             // 项目ID(雪花ID)
	AreaID     stores.AreaID     `gorm:"column:area_id;uniqueIndex:tc_ac;type:bigint;default:2;NOT NULL"`                // 项目区域ID(雪花ID)
	ParentID   int64             `gorm:"column:parent_id;type:bigint;default:0;NOT NULL"`                                // 父组ID 0-根组
	IDPath     string            `gorm:"column:id_path;type:varchar(100);NOT NULL"`                                      // 1-2-3-的格式记录顶级区域到当前区域的路径
	IsLeaf     int64             `gorm:"column:is_leaf;type:bigint;default:1;NOT NULL"`                                  //是否是叶子节点
	ProductID  string            `gorm:"column:product_id;type:varchar(100);default:'';NOT NULL"`                        // 产品id,为空则不限定分组内的产品类型
	Name       string            `gorm:"column:name;uniqueIndex:tc_ac;default:'';type:varchar(100);NOT NULL"`            // 分组名称
	Desc       string            `gorm:"column:desc;type:varchar(200);default:''"`                                       // 描述
	Tags       map[string]string `gorm:"column:tags;type:json;serializer:json;NOT NULL;default:'{}'"`                    // 分组标签
	stores.NoDelTime
	DeviceCount int64              `gorm:"column:device_count;type:bigint;default:0;"` //设备数量统计
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:tc_ac"`
	ProductInfo *DmProductInfo     `gorm:"foreignKey:ProductID;references:ProductID"`
}

设备分组信息表

func (*DmGroupInfo) TableName

func (m *DmGroupInfo) TableName() string

type DmManufacturerInfo

type DmManufacturerInfo struct {
	ID    int64  `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	Name  string `gorm:"column:name;uniqueIndex:pn;type:varchar(100);NOT NULL"` // 协议名称
	Desc  string `gorm:"column:desc;type:varchar(200)"`                         // 描述
	Phone string `gorm:"column:phone;type:varchar(200);default:null"`           //联系电话
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:pn"`
}

func (*DmManufacturerInfo) TableName

func (m *DmManufacturerInfo) TableName() string

type DmOtaFirmwareDevice

type DmOtaFirmwareDevice struct {
	ID              int64               `gorm:"column:id;type:BIGINT;primary_key;AUTO_INCREMENT"`
	FirmwareID      int64               `gorm:"column:firmware_id;uniqueIndex:tc_un"`                    // 升级包ID
	SrcVersion      string              `gorm:"column:src_version;type:varchar(125)"`                    // 设备的原固件版本
	DestVersion     string              `gorm:"column:dest_version;type:varchar(125)"`                   // 设备的目标固件版本
	JobID           int64               `gorm:"column:job_id;uniqueIndex:tc_un;type:BIGINT" `            // 升级批次ID
	ProductID       string              `gorm:"column:product_id;type:varchar(20);uniqueIndex:tc_un"`    // 设备所属产品的productID
	DeviceName      string              `gorm:"column:device_name;type:varchar(100);uniqueIndex:tc_un" ` // 设备名称
	Step            int64               `gorm:"column:step;type:BIGINT"`                                 // 当前的升级进度  0-100%    -1:升级失败。-2:下载失败。-3:校验失败。-4:烧写失败。
	Detail          string              `gorm:"column:detail;type:varchar(256)"`                         //详情
	Status          msgOta.DeviceStatus `gorm:"column:status;index;type:BIGINT"`                         // 设备升级作业状态。1:待确认。 2:待推送。 3:已推送。  4:升级中。 5:升级成功 6: 升级失败. 7:已取消
	PushTime        sql.NullTime        `gorm:"column:push_time"`                                        //推送时间
	LastFailureTime sql.NullTime        `gorm:"column:last_failure_time"`                                //最后失败时间
	stores.NoDelTime
	RetryCount  int64                `gorm:"column:retry_count;default:0"` // 自动重试次数
	DeletedTime stores.DeletedTime   `gorm:"column:deleted_time;default:0;uniqueIndex:tc_un;"`
	Job         *DmOtaFirmwareJob    `gorm:"foreignKey:JobID;references:ID"`
	Firmware    *DmOtaFirmwareInfo   `gorm:"foreignKey:FirmwareID;references:ID"`
	Files       []*DmOtaFirmwareFile `gorm:"foreignKey:FirmwareID;references:FirmwareID"`
}

func (*DmOtaFirmwareDevice) TableName

func (m *DmOtaFirmwareDevice) TableName() string

type DmOtaFirmwareFile

type DmOtaFirmwareFile struct {
	ID         int64  `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	Name       string `gorm:"column:name;type:varchar(64)"`                // 附件名称
	FirmwareID int64  `gorm:"column:firmware_id;type:bigint;NOT NULL"`     // 固件id
	Size       int64  `gorm:"column:size;type:bigint;NOT NULL"`            // 文件大小单位bit
	FilePath   string `gorm:"column:file_path;type:varchar(256);NOT NULL"` // 文件路径,拿来下载文件
	Signature  string `gorm:"column:signature;type:char(32);NOT NULL"`     // 签名值
	FileMd5    string `gorm:"column:file_md5;type:char(32);NOT NULL"`
	stores.Time
}

升级包附件列表

func (*DmOtaFirmwareFile) TableName

func (m *DmOtaFirmwareFile) TableName() string

type DmOtaFirmwareInfo

type DmOtaFirmwareInfo struct {
	ID             int64                `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	ProductID      string               `gorm:"column:product_id;type:varchar(100);uniqueIndex:tc_un;NOT NULL"` // 产品id
	Version        string               `gorm:"column:version;type:varchar(64);uniqueIndex:tc_un"`              // 固件版本
	SrcVersion     string               `gorm:"column:src_version;type:varchar(64)"`                            // 待升级版本号
	Name           string               `gorm:"column:name;type:varchar(64)"`                                   // 固件名称
	ModuleCode     string               `gorm:"column:module_code;type:varchar(64)"`                            // 固件名称
	Desc           string               `gorm:"column:desc;type:varchar(200)"`                                  // 描述
	Status         int64                `gorm:"column:status;type:bigint;NOT NULL"`                             //升级包状态,-1:不需要验证,0:未验证,1:已验证,2:验证中,3:验证失败
	TotalSize      int64                `gorm:"column:total_size;type:bigint;NOT NULL"`                         // 升级包总大小
	IsDiff         int64                `gorm:"column:is_diff;type:smallint;default:1;NOT NULL"`                // 是否差分包,1:整包,2:差分
	SignMethod     string               `gorm:"column:sign_method;type:varchar(20);NOT NULL"`                   // 签名方式:MD5/SHA256
	Extra          string               `gorm:"column:extra;type:varchar(256)"`                                 // 自定义推送参数
	IsNeedToVerify int64                `gorm:"column:is_need_to_verify;type:smallint;default:2;NOT NULL"`      // 是否需要验证
	Files          []*DmOtaFirmwareFile `gorm:"foreignKey:FirmwareID;references:ID"`
	Jobs           []*DmOtaFirmwareJob  `gorm:"foreignKey:FirmwareID;references:ID"`
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:tc_un;"`
}

产品固件升级包信息表

func (*DmOtaFirmwareInfo) TableName

func (m *DmOtaFirmwareInfo) TableName() string

type DmOtaFirmwareJob

type DmOtaFirmwareJob struct {
	ID          int64              `gorm:"column:id;type:BIGINT;primary_key;AUTO_INCREMENT"`
	FirmwareID  int64              `gorm:"column:firmware_id"`                           // 升级包ID,升级包的唯一标识符。
	ProductID   string             `gorm:"column:product_id;type:varchar(100);NOT NULL"` // 产品id
	Type        int64              `gorm:"column:type"`                                  // 升级包所属产品的JobType。 验证升级包:1  批量升级:2
	Status      int64              `gorm:"column:status"`                                // 批次状态,计划中:1  执行中:2  已完成:3  已取消:4
	UpgradeType msgOta.UpgradeType `gorm:"column:upgrade_type"`                          // 升级策略,1-静态,2-动态

	/*
		待升级版本号列表。
			发起全量升级(TargetSelection=ALL)和灰度升级(TargetSelection=GRAY)任务时,可以传入该参数。
			使用差分升级包发起全量升级和灰度升级任务时,该参数值需指定为差分升级包的待升级版本号(SrcVersion)。
			发起定向升级(TargetSelection=SPECIFIC)或分组升级(TargetSelection=GROUP)任务时,不能传入该参数。
			可以调用 QueryDeviceDetail ,查看设备 OTA 模块版本号(FirmwareVersion)。
			列表中不能有重复的版本号。
			最多可传入 10 个版本号。
	*/
	SrcVersions []string `gorm:"column:src_versions;type:json;serializer:json"` // 待升级版本号列表。最多可传入10个版本号。用逗号分隔多个版本号

	RetryInterval    int64 `gorm:"column:retry_interval"`     // 设备升级失败后,自动重试的时间间隔,单位为分钟。 动态升级 静态升级
	RetryCount       int64 `gorm:"column:retry_count"`        // 自动重试次数。1/2/5次 动态升级 静态升级
	TimeoutInMinutes int64 `gorm:"column:timeout_in_minutes"` // 设备升级超时时间,单位为分钟。 动态升级 静态升级
	MaximumPerMinute int64 `gorm:"column:maximum_per_minute"` // 每分钟最多向多少个设备推送升级包下载URL。 动态升级 静态升级

	/*
			是否覆盖之前的升级任务。取值:

			2(默认):不覆盖。若设备已有升级任务,则只执行已有任务。
			1:覆盖。设备只执行新的升级任务。此时 MultiModuleMode 不能传入 true。
		动态升级 静态升级
	*/
	IsOverwriteMode int64 `gorm:"column:is_overwrite_mode;default:2"` // 是否覆盖之前的升级任务。取值:2(不覆盖)、1(覆盖)。
	/*
				物联网平台是否主动向设备推送升级任务。
			1(默认):是。批次任务创建完成后,物联网平台主动将升级任务,直接推送给升级范围内的在线设备。
				此时,设备仍可主动向物联网平台发起请求,来获取 OTA 升级任务信息。
			2:否。设备必须通过向物联网平台发起请求,来获取 OTA 升级任务信息。
		动态升级
	*/
	IsNeedPush int64 `gorm:"column:is_need_push"` // 物联网平台是否主动向设备推送升级任务。

	/*
		如需自主控制设备 OTA 升级时,可配置此参数,通过手机 App 来控制,设备是否可进行 OTA 升级。手机 App 需您自行开发。
			2(默认):否。直接按照 NeedPush 设置,获取 OTA 升级任务信息。
			1:是。设备无法获取 OTA 升级任务,需 App 侧确认 OTA 升级后,才能按照 NeedPush 设置,获取 OTA 升级任务信息。
	*/
	IsNeedConfirm   int64                   `gorm:"is_need_confirm"`
	TargetSelection int64                   `gorm:"column:target_selection;type:bigint;default:1"` //升级范围。 1:全量升级。 2:定向升级。 3:灰度升级。 4:分组升级 5: 区域升级
	TargetID        int64                   `gorm:"column:target_id;type:bigint;default:0"`
	Dynamic         DmOtaFirmwareJobDynamic `gorm:"embedded"`
	Static          DmOtaFirmwareJobStatic  `gorm:"embedded"`
	Firmware        *DmOtaFirmwareInfo      `gorm:"foreignKey:FirmwareID;references:ID"`
	Files           []*DmOtaFirmwareFile    `gorm:"foreignKey:FirmwareID;references:FirmwareID"`
	stores.Time
}

DMOTAjob 表示OTA升级任务的信息

func (*DmOtaFirmwareJob) TableName

func (m *DmOtaFirmwareJob) TableName() string

type DmOtaFirmwareJobDynamic

type DmOtaFirmwareJobDynamic struct {
	/*
			动态升级模式。取值范围:
			1(默认):除了升级当前满足升级条件的设备,还将持续检查设备是否满足升级条件,对满足升级条件的设备进行升级。
			2:仅对后续上报新版本号的设备生效。
		动态升级
	*/
	DynamicMode int64 `gorm:"column:dynamic_mode"` //
}

type DmOtaFirmwareJobStatic

type DmOtaFirmwareJobStatic struct {
	/*
			定向升级的设备名称列表。
			使用差分升级包进行定向升级时,要升级的设备的当前 OTA 模块版本号需与差分升级包的待升级版本号(SrcVersion)相同。
			可以调用 QueryDeviceDetail ,查看设备 OTA 模块版本号(FirmwareVersion)。
			列表中的设备所属的产品必须与升级包所属产品一致。
			列表中不能有重复的设备名称。
			最多可传入 200 个设备名称。
		静态升级
	*/
	TargetDeviceNames []string `gorm:"column:target_device_names;type:json;serializer:json"` // 定向升级的设备名称列表。最多可传入200个设备名称。以逗号分隔
	/*
			指定结束升级的时间。
			结束时间距发起时间(ScheduleTime)最少 1 小时,最多为 30 天。取值为 13 位毫秒值时间戳。
			不传入该参数,则表示不会强制结束升级。
		静态升级
	*/
	ScheduleFinishTime int64 `gorm:"column:schedule_finish_time"` // 指定结束升级的时间,单位为毫秒。
	/*
			指定发起 OTA 升级的时间。
			定时时间范围需为当前时间的 5 分钟后至 7 天内。取值为秒时间戳。
			不传入该参数,则表示立即升级。
		静态升级
	*/
	ScheduleTime int64 `gorm:"column:schedule_time"`
}

type DmOtaModuleInfo

type DmOtaModuleInfo struct {
	ID        int64  `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	ProductID string `gorm:"column:product_id;uniqueIndex:tc_un;type:varchar(20)" ` // 设备所属产品的productID
	Code      string `gorm:"column:code;uniqueIndex:tc_un;type:varchar(64)"`
	Name      string `gorm:"column:name;type:varchar(64)"`  // 固件名称
	Desc      string `gorm:"column:desc;type:varchar(200)"` // 描述
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:tc_un;"`
}

产品固件升级包信息表

func (*DmOtaModuleInfo) TableName

func (m *DmOtaModuleInfo) TableName() string

type DmProductCategory

type DmProductCategory struct {
	ID          int64  `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	Name        string `gorm:"column:name;uniqueIndex:pn;type:varchar(100);NOT NULL"` // 产品品类名称
	Desc        string `gorm:"column:desc;type:varchar(200)"`                         // 描述
	HeadImg     string `gorm:"column:head_img;type:varchar(200)"`                     // 图片
	ParentID    int64  `gorm:"column:parent_id;type:bigint;NOT NULL"`                 // 上级区域ID(雪花ID)
	IDPath      string `gorm:"column:id_path;type:varchar(100);NOT NULL"`             // 1-2-3-的格式记录顶级区域到当前区域的路径
	IsLeaf      int64  `gorm:"column:is_leaf;type:bigint;default:1;NOT NULL"`         //是否是叶子节点
	DeviceCount int64  `gorm:"column:device_count;type:bigint;default:0"`             //该产品品类下的设备数量统计
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:pn"`
}

func (*DmProductCategory) TableName

func (m *DmProductCategory) TableName() string

type DmProductCategorySchema

type DmProductCategorySchema struct {
	ID                int64  `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	ProductCategoryID int64  `gorm:"column:product_category_id;uniqueIndex:pn;type:bigint;NOT NULL"` // 产品品类id
	Identifier        string `gorm:"column:identifier;type:varchar(200);uniqueIndex:pn"`             // 标识符的id
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:pn"`
}

func (*DmProductCategorySchema) TableName

func (m *DmProductCategorySchema) TableName() string

type DmProductCustom

type DmProductCustom struct {
	ID              int64                        `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	ProductID       string                       `gorm:"column:product_id;uniqueIndex:pn;type:varchar(100);NOT NULL"` // 产品id
	ScriptLang      int64                        `gorm:"column:script_lang;type:smallint;default:1"`                  // 脚本语言类型 1:JavaScript 2:lua 3:python
	CustomTopics    []*productCustom.CustomTopic `gorm:"column:custom_topics;type:json"`                              // 自定义topic数组
	TransformScript string                       `gorm:"column:transform_script;type:text"`                           // 协议转换脚本
	LoginAuthScript string                       `gorm:"column:login_auth_script;type:text"`                          // 登录认证脚本
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:pn"`
	ProductInfo *DmProductInfo     `gorm:"foreignKey:ProductID;references:ProductID"`
}

产品自定义协议表

func (*DmProductCustom) TableName

func (m *DmProductCustom) TableName() string

type DmProductID

type DmProductID struct {
	ID int64 `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
}

func (*DmProductID) TableName

func (m *DmProductID) TableName() string

type DmProductInfo

type DmProductInfo struct {
	ID               int64                 `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	ProductID        string                `gorm:"column:product_id;type:varchar(100);uniqueIndex:pd;NOT NULL"` // 产品id
	ProductName      string                `gorm:"column:product_name;type:varchar(100);NOT NULL"`              // 产品名称
	ProductImg       string                `gorm:"column:product_img;type:varchar(200)"`                        // 产品图片
	ProductType      int64                 `gorm:"column:product_type;type:smallint;default:1"`                 // 产品状态:1:开发中,2:审核中,3:已发布
	AuthMode         int64                 `gorm:"column:auth_mode;type:smallint;default:1"`                    // 认证方式:1:账密认证,2:秘钥认证
	DeviceType       int64                 `gorm:"column:device_type;index;type:smallint;default:1"`            // 设备类型:1:设备,2:网关,3:子设备
	CategoryID       int64                 `gorm:"column:category_id;type:integer;default:2"`                   // 产品品类 2:未分类
	NetType          int64                 `gorm:"column:net_type;type:smallint;default:1"`                     // 通讯方式:1:其他,2:wi-fi,3:2G/3G/4G,4:5G,5:BLE,6:LoRaWAN
	ProtocolCode     string                `gorm:"column:protocol_code;type:varchar(100);default:iThings"`      // 协议code,默认iThings  iThings,iThings-thingsboard,wumei,aliyun,huaweiyun,tuya
	AutoRegister     int64                 `gorm:"column:auto_register;type:smallint;default:1"`                // 动态注册:1:关闭,2:打开,3:打开并自动创建设备
	DeviceSchemaMode int64                 `gorm:"column:device_schema_mode;type:smallint;default:1"`           // 设备物模型模式:1:关闭,2:设备自动创建3: 设备自动创建及上报无定义自动创建
	Secret           string                `gorm:"column:secret;type:varchar(50)"`                              // 动态注册产品秘钥
	Desc             string                `gorm:"column:desc;type:varchar(200)"`                               // 描述
	TrialTime        int64                 `gorm:"column:trial_time"`                                           //试用时间(单位为天,为0不限制)
	Status           devices.ProductStatus `gorm:"column:status;type:smallint;default:1"`
	SceneMode        string                `gorm:"column:scene_mode;type:varchar(20);default:rw"`                        // 场景模式 读写类型: r(只读) rw(可读可写) none(不参与场景)
	Tags             map[string]string     `gorm:"column:tags;type:json;serializer:json;NOT NULL;default:'{}'"`          // 产品标签
	ProtocolConf     map[string]string     `gorm:"column:protocol_conf;type:json;serializer:json;NOT NULL;default:'{}'"` // 自定义协议配置
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;uniqueIndex:pd"`
	Category    *DmProductCategory `gorm:"foreignKey:ID;references:CategoryID"` // 添加外键
	Protocol    *DmProtocolInfo    `gorm:"foreignKey:Code;references:ProtocolCode"`
	//Devices []*DmDeviceInfo    `gorm:"foreignKey:ProductID;references:ProductID"` // 添加外键
	CustomUi map[string]*ProductCustomUi `gorm:"column:customUi;type:json;serializer:json;NOT NULL;default:'{}'"`
}

产品信息表

func (*DmProductInfo) TableName

func (m *DmProductInfo) TableName() string

type DmProductRemoteConfig

type DmProductRemoteConfig struct {
	ID        int64  `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	ProductID string `gorm:"column:product_id;uniqueIndex:pn;type:varchar(100);NOT NULL"` // 产品id
	Content   string `gorm:"column:content;type:json;NOT NULL"`                           // 配置内容
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:pn"`
	ProductInfo *DmProductInfo     `gorm:"foreignKey:ProductID;references:ProductID"`
}

产品远程配置表

func (*DmProductRemoteConfig) TableName

func (m *DmProductRemoteConfig) TableName() string

type DmProductSchema

type DmProductSchema struct {
	ID        int64  `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	ProductID string `gorm:"column:product_id;uniqueIndex:identifier;index:product_id_type;type:varchar(100);NOT NULL"` // 产品id
	DmSchemaCore
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:identifier"`
	ProductInfo *DmProductInfo     `gorm:"foreignKey:ProductID;references:ProductID"`
}

产品物模型表

func (*DmProductSchema) TableName

func (m *DmProductSchema) TableName() string

type DmProtocolInfo

type DmProtocolInfo struct {
	ID            int64                 `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	Name          string                `gorm:"column:name;uniqueIndex:pn;type:varchar(100);NOT NULL"`                // 协议名称
	Code          string                `gorm:"column:code;uniqueIndex:pc;type:varchar(100);default:iThings"`         // iThings,iThings-thingsboard,wumei,aliyun,huaweiyun,tuya
	TransProtocol string                `gorm:"column:trans_protocol;type:varchar(100);default:mqtt"`                 // 传输协议: mqtt,tcp,udp
	Desc          string                `gorm:"column:desc;type:varchar(200)"`                                        // 描述
	ConfigFields  protocol.ConfigFields `gorm:"column:config_fields;type:json;serializer:json;NOT NULL;default:'[]'"` // 需要配置的字段列表,没有可以不传
	ConfigInfos   protocol.ConfigInfos  `gorm:"column:config_infos;type:json;serializer:json;NOT NULL;default:'[]'"`  // 配置列表
	Endpoints     []string              `gorm:"column:endpoints;type:json;serializer:json;NOT NULL;default:'[]'"`     // 协议端点,如果填写了优先使用该字段
	EtcdKey       string                `gorm:"column:etcd_key;type:varchar(200);default:null"`                       // 服务etcd发现的key etcd key
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:pc;uniqueIndex:pn"`
}

自定义协议表

func (*DmProtocolInfo) TableName

func (m *DmProtocolInfo) TableName() string

type DmProtocolService added in v1.0.2

type DmProtocolService struct {
	ID     int64  `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	Code   string `gorm:"column:code;uniqueIndex:pc;type:varchar(100);default:iThings"` //
	Ip     string `gorm:"column:ip;uniqueIndex:pc;type:varchar(100);not null"`          //
	Port   int64  `gorm:"column:port;uniqueIndex:pc;type:varchar(200)"`                 //
	Status int64  `gorm:"column:status;type:bigint;default:2"`
	stores.NoDelTime
}

func (*DmProtocolService) TableName added in v1.0.2

func (m *DmProtocolService) TableName() string

type DmSchemaCore

type DmSchemaCore struct {
	Tag               schema.Tag `gorm:"column:tag;type:smallint;default:1"`                                  // 物模型标签 1:自定义 2:可选 3:必选  必选不可删除
	Type              int64      `gorm:"column:type;index:product_id_type;type:smallint;default:1"`           // 物模型类型 1:property属性 2:event事件 3:action行为
	Identifier        string     `gorm:"column:identifier;uniqueIndex:identifier;type:varchar(100);NOT NULL"` // 标识符
	ExtendConfig      string     `gorm:"column:extend_config;type:text"`                                      //拓展参数
	Required          int64      `gorm:"column:required;type:smallint;default:2"`                             // 是否必须,1是 2否
	Name              string     `gorm:"column:name;type:varchar(100);NOT NULL"`                              // 功能名称
	Desc              string     `gorm:"column:desc;type:varchar(200)"`                                       // 描述
	IsCanSceneLinkage int64      `gorm:"column:is_can_scene_linkage;type:smallint;default:1"`                 // 是否放到场景联动中
	FuncGroup         int64      `gorm:"column:func_group;type:smallint;default:1"`                           // 功能分类: 1:普通功能 2:系统功能
	ControlMode       int64      `gorm:"column:control_mode;type:smallint;default:1"`                         //控制模式: 1: 可以群控,可以单控  2:只能单控
	UserPerm          int64      `gorm:"column:user_auth;type:smallint;default:3"`                            //用户权限操作: 1:r(只读) 3:rw(可读可写)
	IsHistory         int64      `gorm:"column:is_history;type:smallint;default:1"`                           // 是否存储历史记录
	Affordance        string     `gorm:"column:affordance;type:json;NOT NULL"`                                // 各类型的自定义功能定义
	Order             int64      `gorm:"column:order;type:BIGINT;default:1;NOT NULL"`                         // 左侧table排序序号
}

func ToActionPo

func ToActionPo(in *schema.Action) DmSchemaCore

func ToEventPo

func ToEventPo(in *schema.Event) DmSchemaCore

func ToPropertyPo

func ToPropertyPo(in *schema.Property) DmSchemaCore

type DmSchemaInfo added in v1.0.5

type DmSchemaInfo struct {
	ID         int64          `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	ProductID  string         `gorm:"column:product_id;uniqueIndex:identifier;index:product_id_type;type:varchar(100);NOT NULL"`      // 产品id
	DeviceName sql.NullString `gorm:"column:device_name;uniqueIndex:identifier;index:product_id_type;type:varchar(100);default:null"` // 产品id
	DmSchemaCore
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:identifier"`
}

产品物模型表

func (*DmSchemaInfo) TableName added in v1.0.5

func (m *DmSchemaInfo) TableName() string

type DmUserDeviceCollect

type DmUserDeviceCollect struct {
	ID         int64             `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	TenantCode stores.TenantCode `gorm:"column:tenant_code;index;type:VARCHAR(50);NOT NULL"`                              // 租户编码
	ProjectID  stores.ProjectID  `gorm:"column:project_id;type:bigint;default:0;NOT NULL"`                                // 项目ID(雪花ID)
	UserID     int64             `gorm:"column:user_id;type:BIGINT;uniqueIndex:product_id_deviceName;NOT NULL"`           // 问题提出的用户
	ProductID  string            `gorm:"column:product_id;type:varchar(100);uniqueIndex:product_id_deviceName;NOT NULL"`  // 产品id
	DeviceName string            `gorm:"column:device_name;uniqueIndex:product_id_deviceName;type:varchar(100);NOT NULL"` // 设备名称
	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:product_id_deviceName"`
}

func (*DmUserDeviceCollect) TableName

func (m *DmUserDeviceCollect) TableName() string

type DmUserDeviceShare

type DmUserDeviceShare struct {
	ID                int64             `gorm:"column:id;type:bigint;primary_key;AUTO_INCREMENT"`
	TenantCode        stores.TenantCode `gorm:"column:tenant_code;index;type:VARCHAR(50);NOT NULL"`                           // 租户编码
	SharedUserID      int64             `gorm:"column:shared_user_id;type:BIGINT;uniqueIndex:product_id_deviceName;NOT NULL"` // 分享对象的用户ID
	SharedUserAccount string            `gorm:"column:shared_user_account;type:VARCHAR(100);"`                                // 分享对象的用户账号

	ProjectID  int64                 `gorm:"column:project_id;type:bigint;default:0;NOT NULL"`                                // 分享的设备所属的项目
	ProductID  string                `gorm:"column:product_id;type:varchar(100);uniqueIndex:product_id_deviceName;NOT NULL"`  // 产品id
	DeviceName string                `gorm:"column:device_name;uniqueIndex:product_id_deviceName;type:varchar(100);NOT NULL"` // 设备名称
	AuthType   def.AuthType          `gorm:"column:auth_type;type:varchar(100);default:1"`                                    // 权限类型
	AccessPerm map[string]*SharePerm `gorm:"column:access_prem;type:json;serializer:json;NOT NULL;default:'{}'"`              //操作权限 hubLog:设备消息记录,ota:ota升级权限,deviceTiming:设备定时
	SchemaPerm map[string]*SharePerm `gorm:"column:schema_prem;type:json;serializer:json;NOT NULL;default:'{}'"`              //物模型权限,只需要填写需要授权并授权的物模型id
	ExpTime    sql.NullTime          `gorm:"column:exp_time"`                                                                 //过期时间,为0不限制

	stores.NoDelTime
	DeletedTime stores.DeletedTime `gorm:"column:deleted_time;default:0;uniqueIndex:product_id_deviceName"`
}

func (*DmUserDeviceShare) TableName

func (m *DmUserDeviceShare) TableName() string

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 *stores.PageInfo) ([]*DmExample, error)

func (ExampleRepo) FindOne

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

func (ExampleRepo) FindOneByFilter

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

func (ExampleRepo) Insert

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

func (ExampleRepo) MultiInsert

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

批量插入 LightStrategyDevice 记录

func (ExampleRepo) Update

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

func (ExampleRepo) UpdateWithField

func (d ExampleRepo) UpdateWithField(ctx context.Context, f ExampleFilter, updates map[string]any) error

type GatewayDeviceFilter

type GatewayDeviceFilter struct {
	//网关和子设备 至少要有一个填写
	Gateway *devices.Core
	//网关和子设备 至少要有一个填写
	SubDevice  *devices.Core
	SubDevices []*devices.Core
}

type GatewayDeviceRepo

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

func NewGatewayDeviceRepo

func NewGatewayDeviceRepo(in any) *GatewayDeviceRepo

func (GatewayDeviceRepo) CountByFilter

func (g GatewayDeviceRepo) CountByFilter(ctx context.Context, f GatewayDeviceFilter) (size int64, err error)

func (GatewayDeviceRepo) DeleteDevAll

func (m GatewayDeviceRepo) DeleteDevAll(ctx context.Context, dev devices.Core) error

func (GatewayDeviceRepo) FindByFilter

func (GatewayDeviceRepo) FindOneByFilter

func (GatewayDeviceRepo) MultiDelete

func (m GatewayDeviceRepo) MultiDelete(ctx context.Context, gateway *devices.Core, subDevice []*devices.Core) error

批量插入 LightStrategyDevice 记录

func (GatewayDeviceRepo) MultiInsert

func (m GatewayDeviceRepo) MultiInsert(ctx context.Context, gateway *devices.Core, subDevice []*devices.Core) error

type GroupDeviceFilter

type GroupDeviceFilter struct {
	GroupIDs    []int64
	ProductID   string
	DeviceName  string
	WithProduct bool
	WithDevice  bool
	Versions    []string
}

type GroupDeviceRepo

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

func NewGroupDeviceRepo

func NewGroupDeviceRepo(in any) *GroupDeviceRepo

func (GroupDeviceRepo) CountByFilter

func (p GroupDeviceRepo) CountByFilter(ctx context.Context, f GroupDeviceFilter) (size int64, err error)

func (GroupDeviceRepo) DeleteByFilter

func (p GroupDeviceRepo) DeleteByFilter(ctx context.Context, f GroupDeviceFilter) error

func (GroupDeviceRepo) FindByFilter

func (p GroupDeviceRepo) FindByFilter(ctx context.Context, f GroupDeviceFilter, page *stores.PageInfo) ([]*DmGroupDevice, error)

func (GroupDeviceRepo) FindOneByFilter

func (p GroupDeviceRepo) FindOneByFilter(ctx context.Context, f GroupDeviceFilter) (*DmGroupDevice, error)

func (GroupDeviceRepo) MultiDelete

func (m GroupDeviceRepo) MultiDelete(ctx context.Context, groupID int64, data []*devices.Core) error

批量插入 LightStrategyDevice 记录

func (GroupDeviceRepo) MultiInsert

func (m GroupDeviceRepo) MultiInsert(ctx context.Context, data []*DmGroupDevice) error

批量插入 LightStrategyDevice 记录

func (GroupDeviceRepo) MultiUpdate

func (p GroupDeviceRepo) MultiUpdate(ctx context.Context, groupID int64, devices []*DmGroupDevice) error

type GroupInfoFilter

type GroupInfoFilter struct {
	AreaID      int64
	ID          int64
	Names       []string
	ParentID    int64
	IDPath      string
	Name        string
	Tags        map[string]string
	WithProduct bool
}

type GroupInfoRepo

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

func NewGroupInfoRepo

func NewGroupInfoRepo(in any) *GroupInfoRepo

func (GroupInfoRepo) CountByFilter

func (p GroupInfoRepo) CountByFilter(ctx context.Context, f GroupInfoFilter) (size int64, err error)

func (GroupInfoRepo) Delete

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

func (GroupInfoRepo) DeleteByFilter

func (g GroupInfoRepo) DeleteByFilter(ctx context.Context, f GroupInfoFilter) error

func (GroupInfoRepo) FindByFilter

func (p GroupInfoRepo) FindByFilter(ctx context.Context, f GroupInfoFilter, page *stores.PageInfo) ([]*DmGroupInfo, error)

func (GroupInfoRepo) FindOne

func (p GroupInfoRepo) FindOne(ctx context.Context, id int64) (*DmGroupInfo, error)

func (GroupInfoRepo) FindOneByFilter

func (g GroupInfoRepo) FindOneByFilter(ctx context.Context, f GroupInfoFilter) (*DmGroupInfo, error)

func (GroupInfoRepo) Insert

func (g GroupInfoRepo) Insert(ctx context.Context, data *DmGroupInfo) error

func (GroupInfoRepo) Update

func (g GroupInfoRepo) Update(ctx context.Context, data *DmGroupInfo) error

func (GroupInfoRepo) UpdateGroupDeviceCount

func (g GroupInfoRepo) UpdateGroupDeviceCount(ctx context.Context, id int64) error

func (GroupInfoRepo) UpdateWithField

func (d GroupInfoRepo) UpdateWithField(ctx context.Context, f GroupInfoFilter, updates map[string]any) error

type OtaFirmwareDeviceFilter

type OtaFirmwareDeviceFilter struct {
	IDs              []int64
	FirmwareID       int64
	JobID            int64
	ProductID        string
	DeviceName       string
	DeviceNames      []string
	WithScheduleTime bool
	//Msg     int64
	Statues         []int64
	SrcVersion      string
	DestVersion     string
	WithFirmware    bool
	WithJob         bool
	WithFiles       bool
	IsOnline        int64
	LastLogin       time.Time
	RetryCount      *stores.Cmp
	PushTime        *stores.Cmp
	LastFailureTime *stores.Cmp
}

type OtaFirmwareDeviceRepo

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

func NewOtaFirmwareDeviceRepo

func NewOtaFirmwareDeviceRepo(in any) *OtaFirmwareDeviceRepo

func (OtaFirmwareDeviceRepo) BatchUpdateField

func (p OtaFirmwareDeviceRepo) BatchUpdateField(ctx context.Context, f OtaFirmwareDeviceFilter, updateData map[string]interface{}) error

批量更新

func (OtaFirmwareDeviceRepo) CountByFilter

func (p OtaFirmwareDeviceRepo) CountByFilter(ctx context.Context, f OtaFirmwareDeviceFilter) (size int64, err error)

func (OtaFirmwareDeviceRepo) Delete

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

func (OtaFirmwareDeviceRepo) DeleteByFilter

func (OtaFirmwareDeviceRepo) FindByFilter

func (OtaFirmwareDeviceRepo) FindByFilters added in v1.0.4

func (OtaFirmwareDeviceRepo) FindOne

func (OtaFirmwareDeviceRepo) FindOneByFilter

func (OtaFirmwareDeviceRepo) Insert

func (OtaFirmwareDeviceRepo) MultiInsert

func (p OtaFirmwareDeviceRepo) MultiInsert(ctx context.Context, data []*DmOtaFirmwareDevice) error

批量插入 LightStrategyDevice 记录

func (OtaFirmwareDeviceRepo) Update

func (OtaFirmwareDeviceRepo) UpdateStatusByFilter

func (p OtaFirmwareDeviceRepo) UpdateStatusByFilter(ctx context.Context, f OtaFirmwareDeviceFilter, status int64, detail string) error

func (OtaFirmwareDeviceRepo) UpdateStatusByFilters added in v1.0.4

func (p OtaFirmwareDeviceRepo) UpdateStatusByFilters(ctx context.Context, f []OtaFirmwareDeviceFilter, status int64, detail string) error

type OtaFirmwareFileFilter

type OtaFirmwareFileFilter struct {
	ID         int64
	FirmwareID int64
	Size       *int64
}

type OtaFirmwareFileRepo

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

func NewOtaFirmwareFileRepo

func NewOtaFirmwareFileRepo(in any) *OtaFirmwareFileRepo

func (OtaFirmwareFileRepo) CountByFilter

func (p OtaFirmwareFileRepo) CountByFilter(ctx context.Context, f OtaFirmwareFileFilter) (size int64, err error)

func (OtaFirmwareFileRepo) Delete

func (g OtaFirmwareFileRepo) Delete(ctx context.Context, id int64) error

func (OtaFirmwareFileRepo) DeleteByFilter

func (OtaFirmwareFileRepo) FindByFilter

func (OtaFirmwareFileRepo) FindOne

func (OtaFirmwareFileRepo) FindOneByFilter

func (OtaFirmwareFileRepo) Insert

func (OtaFirmwareFileRepo) MultiInsert

func (m OtaFirmwareFileRepo) MultiInsert(ctx context.Context, data []*DmOtaFirmwareFile) error

批量插入 LightStrategyDevice 记录

func (OtaFirmwareFileRepo) Update

type OtaFirmwareInfoFilter

type OtaFirmwareInfoFilter struct {
	ProductID   string
	Name        string
	ID          int64
	Version     string
	WithProduct bool
	WithFiles   bool
	WithJobs    bool
}

type OtaFirmwareInfoRepo

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

func NewOtaFirmwareInfoRepo

func NewOtaFirmwareInfoRepo(in any) *OtaFirmwareInfoRepo

func (OtaFirmwareInfoRepo) CountByFilter

func (p OtaFirmwareInfoRepo) CountByFilter(ctx context.Context, f OtaFirmwareInfoFilter) (size int64, err error)

func (OtaFirmwareInfoRepo) Delete

func (g OtaFirmwareInfoRepo) Delete(ctx context.Context, id int64) error

func (OtaFirmwareInfoRepo) DeleteByFilter

func (OtaFirmwareInfoRepo) FindByFilter

func (OtaFirmwareInfoRepo) FindOne

func (OtaFirmwareInfoRepo) FindOneByFilter

func (OtaFirmwareInfoRepo) Insert

func (OtaFirmwareInfoRepo) MultiInsert

func (m OtaFirmwareInfoRepo) MultiInsert(ctx context.Context, data []*DmOtaFirmwareInfo) error

批量插入 LightStrategyDevice 记录

func (OtaFirmwareInfoRepo) Update

type OtaJobFilter

type OtaJobFilter struct {
	//todo 添加过滤字段
	FirmwareID   int64
	ProductID    string
	DeviceName   string
	WithFirmware bool
	UpgradeType  int64
	Statues      []int64
	WithFiles    bool
}

type OtaJobRepo

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

func NewOtaJobRepo

func NewOtaJobRepo(in any) *OtaJobRepo

func (OtaJobRepo) CountByFilter

func (p OtaJobRepo) CountByFilter(ctx context.Context, f OtaJobFilter) (size int64, err error)

func (OtaJobRepo) Delete

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

func (OtaJobRepo) DeleteByFilter

func (p OtaJobRepo) DeleteByFilter(ctx context.Context, f OtaJobFilter) error

func (OtaJobRepo) FindByFilter

func (p OtaJobRepo) FindByFilter(ctx context.Context, f OtaJobFilter, page *stores.PageInfo) ([]*DmOtaFirmwareJob, error)

func (OtaJobRepo) FindOne

func (p OtaJobRepo) FindOne(ctx context.Context, id int64) (*DmOtaFirmwareJob, error)

func (OtaJobRepo) FindOneByFilter

func (p OtaJobRepo) FindOneByFilter(ctx context.Context, f OtaJobFilter) (*DmOtaFirmwareJob, error)

func (OtaJobRepo) Insert

func (p OtaJobRepo) Insert(ctx context.Context, data *DmOtaFirmwareJob) error

func (OtaJobRepo) MultiInsert

func (p OtaJobRepo) MultiInsert(ctx context.Context, data []*DmOtaFirmwareJob) error

批量插入 LightStrategyDevice 记录

func (OtaJobRepo) Update

func (p OtaJobRepo) Update(ctx context.Context, data *DmOtaFirmwareJob) error

type OtaModuleInfoFilter

type OtaModuleInfoFilter struct {
	ID        int64
	Code      string
	Name      string
	ProductID string
}

type OtaModuleInfoRepo

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

func NewOtaModuleInfoRepo

func NewOtaModuleInfoRepo(in any) *OtaModuleInfoRepo

func (OtaModuleInfoRepo) CountByFilter

func (p OtaModuleInfoRepo) CountByFilter(ctx context.Context, f OtaModuleInfoFilter) (size int64, err error)

func (OtaModuleInfoRepo) Delete

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

func (OtaModuleInfoRepo) DeleteByFilter

func (p OtaModuleInfoRepo) DeleteByFilter(ctx context.Context, f OtaModuleInfoFilter) error

func (OtaModuleInfoRepo) FindByFilter

func (OtaModuleInfoRepo) FindOne

func (OtaModuleInfoRepo) FindOneByFilter

func (OtaModuleInfoRepo) Insert

func (p OtaModuleInfoRepo) Insert(ctx context.Context, data *DmOtaModuleInfo) error

func (OtaModuleInfoRepo) MultiInsert

func (p OtaModuleInfoRepo) MultiInsert(ctx context.Context, data []*DmOtaModuleInfo) error

批量插入 LightStrategyDevice 记录

func (OtaModuleInfoRepo) Update

func (p OtaModuleInfoRepo) Update(ctx context.Context, data *DmOtaModuleInfo) error

type ProductCategoryFilter

type ProductCategoryFilter struct {
	Name       string
	IDPath     string
	ParentID   int64
	ID         int64
	IDs        []int64
	ProductIDs []string
}

type ProductCategoryRepo

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

func NewProductCategoryRepo

func NewProductCategoryRepo(in any) *ProductCategoryRepo

func (ProductCategoryRepo) CountByFilter

func (p ProductCategoryRepo) CountByFilter(ctx context.Context, f ProductCategoryFilter) (size int64, err error)

func (ProductCategoryRepo) Delete

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

func (ProductCategoryRepo) DeleteByFilter

func (ProductCategoryRepo) FindByFilter

func (ProductCategoryRepo) FindOne

func (ProductCategoryRepo) FindOneByFilter

func (ProductCategoryRepo) Insert

func (ProductCategoryRepo) MultiInsert

func (p ProductCategoryRepo) MultiInsert(ctx context.Context, data []*DmProductCategory) error

批量插入 LightStrategyDevice 记录

func (ProductCategoryRepo) Update

func (ProductCategoryRepo) UpdateWithField

func (d ProductCategoryRepo) UpdateWithField(ctx context.Context, f ProductCategoryFilter, updates map[string]any) error

type ProductCategorySchemaFilter

type ProductCategorySchemaFilter struct {
	ProductCategoryID  int64
	ProductCategoryIDs []int64
	Identifiers        []string
}

type ProductCategorySchemaRepo

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

func NewProductCategorySchemaRepo

func NewProductCategorySchemaRepo(in any) *ProductCategorySchemaRepo

func (ProductCategorySchemaRepo) CountByFilter

func (ProductCategorySchemaRepo) Delete

func (ProductCategorySchemaRepo) DeleteByFilter

func (ProductCategorySchemaRepo) FindByFilter

func (ProductCategorySchemaRepo) FindOne

func (ProductCategorySchemaRepo) FindOneByFilter

func (ProductCategorySchemaRepo) Insert

func (ProductCategorySchemaRepo) MultiInsert

批量插入 LightStrategyDevice 记录

func (ProductCategorySchemaRepo) MultiUpdate

func (p ProductCategorySchemaRepo) MultiUpdate(ctx context.Context, productCategoryID int64, identifiers []string) error

func (ProductCategorySchemaRepo) Update

type ProductCustomRepo

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

func NewProductCustomRepo

func NewProductCustomRepo(in any) *ProductCustomRepo

func (ProductCustomRepo) FindOneByProductID

func (p ProductCustomRepo) FindOneByProductID(ctx context.Context, productID string) (*DmProductCustom, error)

func (ProductCustomRepo) Insert

func (p ProductCustomRepo) Insert(ctx context.Context, data *DmProductCustom) error

func (ProductCustomRepo) Update

func (p ProductCustomRepo) Update(ctx context.Context, data *DmProductCustom) error

type ProductCustomUi

type ProductCustomUi struct {
	Type    string `json:"type"` //detail(设备详情) ,setNet(配置网络)
	Path    string `json:"path"`
	Version int64  `json:"version"`
}

type ProductFilter

type ProductFilter struct {
	DeviceType   int64
	DeviceTypes  []int64
	ProductName  string
	ProductIDs   []string
	ProductNames []string
	Tags         map[string]string
	ProtocolConf map[string]string
	WithProtocol bool
	WithCategory bool
	ProtocolCode string
	CategoryIDs  []int64
	SceneMode    string
	SceneModes   []string
	Status       devices.ProductStatus
	Statuses     []devices.ProductStatus
	AreaID       int64
	NetType      int64
}

type ProductIDFilter

type ProductIDFilter struct {
}

type ProductIDRepo

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

func NewProductIDRepo

func NewProductIDRepo(in any) *ProductIDRepo

func (ProductIDRepo) CountByFilter

func (p ProductIDRepo) CountByFilter(ctx context.Context, f ProductIDFilter) (size int64, err error)

func (ProductIDRepo) Delete

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

func (ProductIDRepo) DeleteByFilter

func (p ProductIDRepo) DeleteByFilter(ctx context.Context, f ProductIDFilter) error

func (ProductIDRepo) FindByFilter

func (p ProductIDRepo) FindByFilter(ctx context.Context, f ProductIDFilter, page *stores.PageInfo) ([]*DmProductID, error)

func (ProductIDRepo) FindOne

func (p ProductIDRepo) FindOne(ctx context.Context, id int64) (*DmProductID, error)

func (ProductIDRepo) FindOneByFilter

func (p ProductIDRepo) FindOneByFilter(ctx context.Context, f ProductIDFilter) (*DmProductID, error)

func (ProductIDRepo) GenID

func (p ProductIDRepo) GenID(ctx context.Context) (int64, error)

func (ProductIDRepo) Insert

func (p ProductIDRepo) Insert(ctx context.Context, data *DmProductID) error

func (ProductIDRepo) MultiInsert

func (p ProductIDRepo) MultiInsert(ctx context.Context, data []*DmProductID) error

批量插入 LightStrategyDevice 记录

func (ProductIDRepo) Update

func (p ProductIDRepo) Update(ctx context.Context, data *DmProductID) error

func (ProductIDRepo) UpdateWithField

func (d ProductIDRepo) UpdateWithField(ctx context.Context, f ProductIDFilter, updates map[string]any) error

type ProductInfoRepo

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

func NewProductInfoRepo

func NewProductInfoRepo(in any) *ProductInfoRepo

func (ProductInfoRepo) CountByFilter

func (p ProductInfoRepo) CountByFilter(ctx context.Context, f ProductFilter) (size int64, err error)

func (ProductInfoRepo) DeleteByFilter

func (p ProductInfoRepo) DeleteByFilter(ctx context.Context, f ProductFilter) error

func (ProductInfoRepo) FindByFilter

func (p ProductInfoRepo) FindByFilter(ctx context.Context, f ProductFilter, page *stores.PageInfo) ([]*DmProductInfo, error)

func (ProductInfoRepo) FindOneByFilter

func (p ProductInfoRepo) FindOneByFilter(ctx context.Context, f ProductFilter) (*DmProductInfo, error)

func (ProductInfoRepo) Insert

func (p ProductInfoRepo) Insert(ctx context.Context, data *DmProductInfo) error

func (ProductInfoRepo) Update

func (p ProductInfoRepo) Update(ctx context.Context, data *DmProductInfo) error

type ProductRemoteConfigRepo

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

func NewProductRemoteConfigRepo

func NewProductRemoteConfigRepo(in any) *ProductRemoteConfigRepo

func (ProductRemoteConfigRepo) CountByFilter

func (p ProductRemoteConfigRepo) CountByFilter(ctx context.Context, f RemoteConfigFilter) (size int64, err error)

func (ProductRemoteConfigRepo) DeleteByFilter

func (ProductRemoteConfigRepo) FindByFilter

func (ProductRemoteConfigRepo) FindOneByFilter

func (ProductRemoteConfigRepo) Insert

func (ProductRemoteConfigRepo) Update

type ProductSchemaFilter

type ProductSchemaFilter struct {
	ID                int64
	ProductID         string   //产品id  必填
	ProductIDs        []string //产品id列表
	Type              int64    //物模型类型 1:property属性 2:event事件 3:action行为
	Types             []int64
	Tag               schema.Tag //过滤条件: 物模型标签 1:自定义 2:可选 3:必选
	Tags              []schema.Tag
	Identifiers       []string //过滤标识符列表
	Name              string
	IsCanSceneLinkage int64
	FuncGroup         int64
	UserPerm          int64
	PropertyMode      string
	ControlMode       int64
	ProductSceneMode  string
}

type ProductSchemaOldFilter added in v1.0.5

type ProductSchemaOldFilter struct {
	ID                int64
	ProductID         string   //产品id  必填
	ProductIDs        []string //产品id列表
	Type              int64    //物模型类型 1:property属性 2:event事件 3:action行为
	Types             []int64
	Tag               schema.Tag //过滤条件: 物模型标签 1:自定义 2:可选 3:必选
	Tags              []schema.Tag
	Identifiers       []string //过滤标识符列表
	Name              string
	IsCanSceneLinkage int64
	FuncGroup         int64
	UserPerm          int64
	PropertyMode      string
	ControlMode       int64
	ProductSceneMode  string
}

type ProductSchemaOldRepo added in v1.0.5

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

func NewProductSchemaOldRepo added in v1.0.5

func NewProductSchemaOldRepo(in any) *ProductSchemaOldRepo

func (ProductSchemaOldRepo) CountByFilter added in v1.0.5

func (p ProductSchemaOldRepo) CountByFilter(ctx context.Context, f ProductSchemaFilter) (size int64, err error)

func (ProductSchemaOldRepo) DeleteByFilter added in v1.0.5

func (ProductSchemaOldRepo) FindByFilter added in v1.0.5

func (ProductSchemaOldRepo) FindOneByFilter added in v1.0.5

func (ProductSchemaOldRepo) FindProductIDByFilter added in v1.0.5

func (p ProductSchemaOldRepo) FindProductIDByFilter(ctx context.Context, f ProductSchemaFilter) ([]string, error)

func (ProductSchemaOldRepo) Insert added in v1.0.5

func (ProductSchemaOldRepo) MultiInsert added in v1.0.5

func (p ProductSchemaOldRepo) MultiInsert(ctx context.Context, data []*DmProductSchema) error

批量插入 LightStrategyDevice 记录

func (ProductSchemaOldRepo) MultiUpdate added in v1.0.5

func (p ProductSchemaOldRepo) MultiUpdate(ctx context.Context, productID string, schemaInfo *schema.Model) error

func (ProductSchemaOldRepo) Update added in v1.0.5

func (ProductSchemaOldRepo) UpdateTag added in v1.0.5

func (p ProductSchemaOldRepo) UpdateTag(ctx context.Context, productIDs []string, identifiers []string, oldTag, newTag int64) error

func (ProductSchemaOldRepo) UpdateWithCommon added in v1.0.5

func (p ProductSchemaOldRepo) UpdateWithCommon(ctx context.Context, common *DmCommonSchema) error

type ProductSchemaRepo

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

func NewProductSchemaRepo

func NewProductSchemaRepo(in any) *ProductSchemaRepo

func (ProductSchemaRepo) CountByFilter

func (p ProductSchemaRepo) CountByFilter(ctx context.Context, f ProductSchemaFilter) (size int64, err error)

func (ProductSchemaRepo) DeleteByFilter

func (p ProductSchemaRepo) DeleteByFilter(ctx context.Context, f ProductSchemaFilter) error

func (ProductSchemaRepo) FindByFilter

func (ProductSchemaRepo) FindOneByFilter

func (ProductSchemaRepo) FindProductIDByFilter

func (p ProductSchemaRepo) FindProductIDByFilter(ctx context.Context, f ProductSchemaFilter) ([]string, error)

func (ProductSchemaRepo) Insert

func (p ProductSchemaRepo) Insert(ctx context.Context, data *DmSchemaInfo) error

func (ProductSchemaRepo) MultiInsert

func (p ProductSchemaRepo) MultiInsert(ctx context.Context, data []*DmSchemaInfo) error

批量插入 LightStrategyDevice 记录

func (ProductSchemaRepo) MultiUpdate

func (p ProductSchemaRepo) MultiUpdate(ctx context.Context, productID string, schemaInfo *schema.Model) error

func (ProductSchemaRepo) Update

func (p ProductSchemaRepo) Update(ctx context.Context, data *DmSchemaInfo) error

func (ProductSchemaRepo) UpdateTag

func (p ProductSchemaRepo) UpdateTag(ctx context.Context, productIDs []string, identifiers []string, oldTag, newTag int64) error

func (ProductSchemaRepo) UpdateWithCommon

func (p ProductSchemaRepo) UpdateWithCommon(ctx context.Context, common *DmCommonSchema) error

type ProtocolInfoFilter

type ProtocolInfoFilter struct {
	ID            int64
	Name          string
	Code          string //  iThings,iThings-thingsboard,wumei,aliyun,huaweiyun,tuya
	TransProtocol string // 传输协议: mqtt,tcp,udp
	NotCodes      []string
}

type ProtocolInfoRepo

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

func NewProtocolInfoRepo

func NewProtocolInfoRepo(in any) *ProtocolInfoRepo

func (ProtocolInfoRepo) CountByFilter

func (p ProtocolInfoRepo) CountByFilter(ctx context.Context, f ProtocolInfoFilter) (size int64, err error)

func (ProtocolInfoRepo) Delete

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

func (ProtocolInfoRepo) DeleteByFilter

func (p ProtocolInfoRepo) DeleteByFilter(ctx context.Context, f ProtocolInfoFilter) error

func (ProtocolInfoRepo) FindByFilter

func (ProtocolInfoRepo) FindOne

func (p ProtocolInfoRepo) FindOne(ctx context.Context, id int64) (*DmProtocolInfo, error)

func (ProtocolInfoRepo) FindOneByFilter

func (ProtocolInfoRepo) Insert

func (p ProtocolInfoRepo) Insert(ctx context.Context, data *DmProtocolInfo) error

func (ProtocolInfoRepo) MultiInsert

func (p ProtocolInfoRepo) MultiInsert(ctx context.Context, data []*DmProtocolInfo) error

批量插入 LightStrategyDevice 记录

func (ProtocolInfoRepo) Update

func (p ProtocolInfoRepo) Update(ctx context.Context, data *DmProtocolInfo) error

type ProtocolServiceFilter added in v1.0.2

type ProtocolServiceFilter struct {
	ID   int64
	Code string //  iThings,iThings-thingsboard,wumei,aliyun,huaweiyun,tuya
	IP   string
	Port int64
}

type ProtocolServiceRepo added in v1.0.2

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

func NewProtocolServiceRepo added in v1.0.2

func NewProtocolServiceRepo(in any) *ProtocolServiceRepo

func (ProtocolServiceRepo) CountByFilter added in v1.0.2

func (p ProtocolServiceRepo) CountByFilter(ctx context.Context, f ProtocolServiceFilter) (size int64, err error)

func (ProtocolServiceRepo) Delete added in v1.0.2

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

func (ProtocolServiceRepo) DeleteByFilter added in v1.0.2

func (ProtocolServiceRepo) DownStatus added in v1.0.2

func (p ProtocolServiceRepo) DownStatus(ctx context.Context) error

func (ProtocolServiceRepo) FindByFilter added in v1.0.2

func (ProtocolServiceRepo) FindOne added in v1.0.2

func (ProtocolServiceRepo) FindOneByFilter added in v1.0.2

func (ProtocolServiceRepo) Insert added in v1.0.2

func (ProtocolServiceRepo) MultiInsert added in v1.0.2

func (p ProtocolServiceRepo) MultiInsert(ctx context.Context, data []*DmProtocolService) error

批量插入 LightStrategyDevice 记录

func (ProtocolServiceRepo) Update added in v1.0.2

type RemoteConfigFilter

type RemoteConfigFilter struct {
	ProductID string
}

type SchemaInfoFilter added in v1.0.5

type SchemaInfoFilter struct {
	ID                int64
	ProductID         string //产品id  必填
	DeviceName        string //设备ID
	Type              int64  //物模型类型 1:property属性 2:event事件 3:action行为
	Types             []int64
	Tag               schema.Tag //过滤条件: 物模型标签 1:自定义 2:可选 3:必选
	Tags              []schema.Tag
	Identifiers       []string //过滤标识符列表
	Name              string
	IsCanSceneLinkage int64
	FuncGroup         int64
	UserPerm          int64
	PropertyMode      string
	ControlMode       int64
	ProductSceneMode  string
}

type SchemaInfoRepo added in v1.0.5

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

func NewSchemaInfoRepo added in v1.0.5

func NewSchemaInfoRepo(in any) *SchemaInfoRepo

func (SchemaInfoRepo) CountByFilter added in v1.0.5

func (p SchemaInfoRepo) CountByFilter(ctx context.Context, f SchemaInfoFilter) (size int64, err error)

func (SchemaInfoRepo) DeleteByFilter added in v1.0.5

func (p SchemaInfoRepo) DeleteByFilter(ctx context.Context, f SchemaInfoFilter) error

func (SchemaInfoRepo) FindByFilter added in v1.0.5

func (p SchemaInfoRepo) FindByFilter(ctx context.Context, f SchemaInfoFilter, page *stores.PageInfo) ([]*DmSchemaInfo, error)

func (SchemaInfoRepo) FindOneByFilter added in v1.0.5

func (p SchemaInfoRepo) FindOneByFilter(ctx context.Context, f SchemaInfoFilter) (*DmSchemaInfo, error)

func (SchemaInfoRepo) Insert added in v1.0.5

func (p SchemaInfoRepo) Insert(ctx context.Context, data *DmSchemaInfo) error

func (SchemaInfoRepo) MultiInsert added in v1.0.5

func (p SchemaInfoRepo) MultiInsert(ctx context.Context, data []*DmSchemaInfo) error

批量插入 LightStrategyDevice 记录

func (SchemaInfoRepo) MultiInsert2 added in v1.0.5

func (p SchemaInfoRepo) MultiInsert2(ctx context.Context, productID string, deviceName string, schemaInfo *schema.Model) error

批量插入 LightStrategyDevice 记录

func (SchemaInfoRepo) MultiUpdate added in v1.0.5

func (p SchemaInfoRepo) MultiUpdate(ctx context.Context, productID string, deviceName string, schemaInfo *schema.Model) error

func (SchemaInfoRepo) Update added in v1.0.5

func (p SchemaInfoRepo) Update(ctx context.Context, data *DmSchemaInfo) error

func (SchemaInfoRepo) UpdateTag added in v1.0.5

func (p SchemaInfoRepo) UpdateTag(ctx context.Context, productIDs []string, identifiers []string, oldTag, newTag int64) error

type ShadowRepo

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

func (*ShadowRepo) FindByFilter

func (p *ShadowRepo) FindByFilter(ctx context.Context, f shadow.Filter) ([]*shadow.Info, error)

func (*ShadowRepo) MultiDelete

func (p *ShadowRepo) MultiDelete(ctx context.Context, f shadow.Filter) error

func (*ShadowRepo) MultiUpdate

func (p *ShadowRepo) MultiUpdate(ctx context.Context, data []*shadow.Info) error

type SharePerm

type SharePerm struct {
	Perm int64 `json:"perm"` //1:r(只读) 3(默认):rw(可读可写)
}

type UserDeviceCollectFilter

type UserDeviceCollectFilter struct {
	Cores  []*devices.Core
	UserID int64
}

type UserDeviceCollectRepo

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

func NewUserDeviceCollectRepo

func NewUserDeviceCollectRepo(in any) *UserDeviceCollectRepo

func (UserDeviceCollectRepo) CountByFilter

func (p UserDeviceCollectRepo) CountByFilter(ctx context.Context, f UserDeviceCollectFilter) (size int64, err error)

func (UserDeviceCollectRepo) Delete

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

func (UserDeviceCollectRepo) DeleteByFilter

func (UserDeviceCollectRepo) FindByFilter

func (UserDeviceCollectRepo) FindOne

func (UserDeviceCollectRepo) FindOneByFilter

func (UserDeviceCollectRepo) Insert

func (UserDeviceCollectRepo) MultiInsert

func (p UserDeviceCollectRepo) MultiInsert(ctx context.Context, data []*DmUserDeviceCollect) error

批量插入 LightStrategyDevice 记录

func (UserDeviceCollectRepo) Update

func (UserDeviceCollectRepo) UpdateWithField

func (d UserDeviceCollectRepo) UpdateWithField(ctx context.Context, f UserDeviceCollectFilter, updates map[string]any) error

type UserDeviceShareFilter

type UserDeviceShareFilter struct {
	ProjectID     int64
	SharedUserIDs []int64
	Devices       []*devices.Core
	ProductID     string
	DeviceName    string
	SharedUserID  int64
	ID            int64
	IDs           []int64
	ExpTime       *stores.Cmp
}

type UserDeviceShareRepo

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

func NewUserDeviceShareRepo

func NewUserDeviceShareRepo(in any) *UserDeviceShareRepo

func (UserDeviceShareRepo) CountByFilter

func (p UserDeviceShareRepo) CountByFilter(ctx context.Context, f UserDeviceShareFilter) (size int64, err error)

func (UserDeviceShareRepo) Delete

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

func (UserDeviceShareRepo) DeleteByFilter

func (UserDeviceShareRepo) FindByFilter

func (UserDeviceShareRepo) FindOne

func (UserDeviceShareRepo) FindOneByFilter

func (UserDeviceShareRepo) Insert

func (UserDeviceShareRepo) MultiInsert

func (p UserDeviceShareRepo) MultiInsert(ctx context.Context, data []*DmUserDeviceShare) error

批量插入 LightStrategyDevice 记录

func (UserDeviceShareRepo) Update

func (UserDeviceShareRepo) UpdateWithField

func (d UserDeviceShareRepo) UpdateWithField(ctx context.Context, f UserDeviceShareFilter, updates map[string]any) error

Jump to

Keyboard shortcuts

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