Documentation
¶
Index ¶
- Variables
- func ToActionDo(in *DmProductSchema) *schema.Action
- func ToEventDo(in *DmProductSchema) *schema.Event
- func ToPropertyDo(in *DmProductSchema) *schema.Property
- func ToSchemaDo(in []*DmProductSchema) *schema.Model
- type ActionDef
- type DeviceFilter
- type DmDeviceInfo
- type DmDeviceInfoModel
- type DmGatewayDevice
- type DmGatewayDeviceModel
- type DmGroupDevice
- type DmGroupDeviceModel
- type DmGroupInfo
- type DmGroupInfoModel
- type DmGroupModel
- type DmProductFirmware
- type DmProductFirmwareModel
- type DmProductInfo
- type DmProductInfoModel
- type DmProductRemoteConfig
- type DmProductRemoteConfigModel
- type DmProductSchema
- type DmProductSchemaModel
- type DmRemoteConfigModel
- type EventDef
- type GatewayDeviceFilter
- type GroupDeviceFilter
- type GroupFilter
- type GroupInformation
- type ProductFilter
- type ProductSchemaFilter
- type PropertyDef
- type RemoteConfigFilter
- type RemoteConfigInfo
Constants ¶
This section is empty.
Variables ¶
var ErrDuplicate = errors.New("sql: duplicate key")
var ErrNotFound = sqlx.ErrNotFound
Functions ¶
func ToActionDo ¶
func ToActionDo(in *DmProductSchema) *schema.Action
func ToEventDo ¶
func ToEventDo(in *DmProductSchema) *schema.Event
func ToPropertyDo ¶
func ToPropertyDo(in *DmProductSchema) *schema.Property
func ToSchemaDo ¶
func ToSchemaDo(in []*DmProductSchema) *schema.Model
Types ¶
type DeviceFilter ¶
type DeviceFilter struct {
ProductID string
DeviceName string
Tags map[string]string
LastLoginTime struct {
Start int64
End int64
}
IsOnline []int64
Range int64
Position string
}
func (*DeviceFilter) FmtSql ¶
func (d *DeviceFilter) FmtSql(sql sq.SelectBuilder) sq.SelectBuilder
type DmDeviceInfo ¶ added in v0.3.0
type DmDeviceInfo struct {
Id int64 `db:"id"`
ProductID string `db:"productID"` // 产品id
DeviceName string `db:"deviceName"` // 设备名称
Secret string `db:"secret"` // 设备秘钥
FirstLogin sql.NullTime `db:"firstLogin"` // 激活时间
LastLogin sql.NullTime `db:"lastLogin"` // 最后上线时间
CreatedTime time.Time `db:"createdTime"`
UpdatedTime time.Time `db:"updatedTime"`
DeletedTime sql.NullTime `db:"deletedTime"`
Version string `db:"version"` // 固件版本
LogLevel int64 `db:"logLevel"` // 日志级别:1)关闭 2)错误 3)告警 4)信息 5)调试
Cert string `db:"cert"` // 设备证书
IsOnline int64 `db:"isOnline"` // 是否在线,1是2否
Tags string `db:"tags"` // 设备标签
Address string `db:"address"` // 所在地址
Position string `db:"position"` // 设备的位置,默认百度坐标系BD09
}
type DmDeviceInfoModel ¶ added in v0.3.0
type DmDeviceInfoModel interface {
InsertDeviceInfo(ctx context.Context, data *DmDeviceInfo) error
FindByFilter(ctx context.Context, filter DeviceFilter, page def.PageInfo) ([]*DmDeviceInfo, error)
CountByFilter(ctx context.Context, filter DeviceFilter) (size int64, err error)
CountGroupByField(ctx context.Context, filter DeviceFilter, fieldName string) (map[string]int64, error)
FindOneByProductIDAndDeviceName(ctx context.Context, productID string, deviceName string) (*DmDeviceInfo, error)
UpdateDeviceInfo(ctx context.Context, data *DmDeviceInfo) error
// contains filtered or unexported methods
}
DmDeviceInfoModel is an interface to be customized, add more methods here, and implement the added methods in customDmDeviceInfoModel.
func NewDmDeviceInfoModel ¶ added in v0.3.0
func NewDmDeviceInfoModel(conn sqlx.SqlConn) DmDeviceInfoModel
NewDmDeviceInfoModel returns a model for the database table.
type DmGatewayDevice ¶ added in v0.3.0
type DmGatewayDevice struct {
Id int64 `db:"id"`
GatewayProductID string `db:"gatewayProductID"` // 网关产品id
GatewayDeviceName string `db:"gatewayDeviceName"` // 网关设备名称
ProductID string `db:"productID"` // 子设备产品id
DeviceName string `db:"deviceName"` // 子设备名称
CreatedTime time.Time `db:"createdTime"` // 创建时间
UpdatedTime time.Time `db:"updatedTime"` // 更新时间
DeletedTime sql.NullTime `db:"deletedTime"` // 删除时间
}
type DmGatewayDeviceModel ¶ added in v0.3.0
type DmGatewayDeviceModel interface {
CreateList(ctx context.Context, gateway *devices.Core, subDevices []*devices.Core) error
DeleteList(ctx context.Context, gateway *devices.Core, subDevices []*devices.Core) error
FindByFilter(ctx context.Context, filter GatewayDeviceFilter, page *def.PageInfo) ([]*DmDeviceInfo, error)
CountByFilter(ctx context.Context, filter GatewayDeviceFilter) (size int64, err error)
// contains filtered or unexported methods
}
DmGatewayDeviceModel is an interface to be customized, add more methods here, and implement the added methods in customDmGatewayDeviceModel.
func NewDmGatewayDeviceModel ¶ added in v0.3.0
func NewDmGatewayDeviceModel(conn sqlx.SqlConn) DmGatewayDeviceModel
NewDmGatewayDeviceModel returns a model for the database table.
type DmGroupDevice ¶ added in v0.3.0
type DmGroupDevice struct {
Id int64 `db:"id"`
GroupID int64 `db:"groupID"` // 分组ID
ProductID string `db:"productID"` // 产品id
DeviceName string `db:"deviceName"` // 设备名称
CreatedTime time.Time `db:"createdTime"` // 创建时间
UpdatedTime time.Time `db:"updatedTime"` // 更新时间
DeletedTime sql.NullTime `db:"deletedTime"` // 删除时间
}
type DmGroupDeviceModel ¶ added in v0.3.0
type DmGroupDeviceModel interface {
// contains filtered or unexported methods
}
DmGroupDeviceModel is an interface to be customized, add more methods here, and implement the added methods in customDmGroupDeviceModel.
func NewDmGroupDeviceModel ¶ added in v0.3.0
func NewDmGroupDeviceModel(conn sqlx.SqlConn) DmGroupDeviceModel
NewDmGroupDeviceModel returns a model for the database table.
type DmGroupInfo ¶ added in v0.3.0
type DmGroupInfo struct {
GroupID int64 `db:"groupID"` // 分组ID
ParentID int64 `db:"parentID"` // 父组ID 0-根组
GroupName string `db:"groupName"` // 分组名称
Desc string `db:"desc"` // 描述
Tags string `db:"tags"` // 分组标签
CreatedTime time.Time `db:"createdTime"` // 创建时间
UpdatedTime time.Time `db:"updatedTime"` // 更新时间
DeletedTime sql.NullTime `db:"deletedTime"` // 删除时间
}
type DmGroupInfoModel ¶ added in v0.3.0
type DmGroupInfoModel interface {
// contains filtered or unexported methods
}
DmGroupInfoModel is an interface to be customized, add more methods here, and implement the added methods in customDmGroupInfoModel.
func NewDmGroupInfoModel ¶ added in v0.3.0
func NewDmGroupInfoModel(conn sqlx.SqlConn) DmGroupInfoModel
NewDmGroupInfoModel returns a model for the database table.
type DmGroupModel ¶ added in v0.3.0
type DmGroupModel interface {
Index(ctx context.Context, in *GroupFilter) ([]*GroupInformation, int64, error)
IndexAll(ctx context.Context, in *GroupFilter) ([]*GroupInformation, error)
IndexGD(ctx context.Context, in *GroupDeviceFilter) ([]*DmGroupDevice, int64, error)
Delete(ctx context.Context, groupID int64) error
GroupDeviceCreate(ctx context.Context, groupID int64, list []*devices.Core) error
GroupDeviceDelete(ctx context.Context, groupID int64, list []*devices.Core) error
}
func NewDmGroupModel ¶ added in v0.3.0
func NewDmGroupModel(conn sqlx.SqlConn) DmGroupModel
type DmProductFirmware ¶ added in v0.3.0
type DmProductFirmware struct {
Id int64 `db:"id"`
ProductID string `db:"productID"` // 产品id
Version string `db:"version"` // 固件版本
CreatedTime time.Time `db:"createdTime"`
UpdatedTime time.Time `db:"updatedTime"`
DeletedTime sql.NullTime `db:"deletedTime"`
Name string `db:"name"` // 固件名称
Desc string `db:"desc"` // 描述
Size int64 `db:"size"` // 固件大小
Dir string `db:"dir"` // 固件标识,拿来下载文件
}
type DmProductFirmwareModel ¶ added in v0.3.0
type DmProductFirmwareModel interface {
// contains filtered or unexported methods
}
DmProductFirmwareModel is an interface to be customized, add more methods here, and implement the added methods in customDmProductFirmwareModel.
func NewDmProductFirmwareModel ¶ added in v0.3.0
func NewDmProductFirmwareModel(conn sqlx.SqlConn) DmProductFirmwareModel
NewDmProductFirmwareModel returns a model for the database table.
type DmProductInfo ¶ added in v0.3.0
type DmProductInfo struct {
ProductID string `db:"productID"` // 产品id
ProductName string `db:"productName"` // 产品名称
ProductType int64 `db:"productType"` // 产品状态:1:开发中,2:审核中,3:已发布
AuthMode int64 `db:"authMode"` // 认证方式:1:账密认证,2:秘钥认证
DeviceType int64 `db:"deviceType"` // 设备类型:1:设备,2:网关,3:子设备
CategoryID int64 `db:"categoryID"` // 产品品类
NetType int64 `db:"netType"` // 通讯方式:1:其他,2:wi-fi,3:2G/3G/4G,4:5G,5:BLE,6:LoRaWAN
DataProto int64 `db:"dataProto"` // 数据协议:1:自定义,2:数据模板
AutoRegister int64 `db:"autoRegister"` // 动态注册:1:关闭,2:打开,3:打开并自动创建设备
Secret string `db:"secret"` // 动态注册产品秘钥
Desc string `db:"desc"` // 描述
CreatedTime time.Time `db:"createdTime"`
UpdatedTime time.Time `db:"updatedTime"`
DeletedTime sql.NullTime `db:"deletedTime"`
DevStatus string `db:"devStatus"` // 产品状态
Tags string `db:"tags"` // 产品标签
}
type DmProductInfoModel ¶ added in v0.3.0
type DmProductInfoModel interface {
FindByFilter(ctx context.Context, filter ProductFilter, page *def.PageInfo) ([]*DmProductInfo, error)
CountByFilter(ctx context.Context, filter ProductFilter) (size int64, err error)
// contains filtered or unexported methods
}
DmProductInfoModel is an interface to be customized, add more methods here, and implement the added methods in customDmProductInfoModel.
func NewDmProductInfoModel ¶ added in v0.3.0
func NewDmProductInfoModel(conn sqlx.SqlConn) DmProductInfoModel
NewDmProductInfoModel returns a model for the database table.
type DmProductRemoteConfig ¶ added in v0.3.0
type DmProductRemoteConfigModel ¶ added in v0.3.0
type DmProductRemoteConfigModel interface {
// contains filtered or unexported methods
}
DmProductRemoteConfigModel is an interface to be customized, add more methods here, and implement the added methods in customDmProductRemoteConfigModel.
func NewDmProductRemoteConfigModel ¶ added in v0.3.0
func NewDmProductRemoteConfigModel(conn sqlx.SqlConn) DmProductRemoteConfigModel
NewDmProductRemoteConfigModel returns a model for the database table.
type DmProductSchema ¶ added in v0.3.0
type DmProductSchema struct {
Id int64 `db:"id"`
ProductID string `db:"productID"` // 产品id
Tag int64 `db:"tag"` // 物模型标签 1:自定义 2:可选 3:必选 必选不可删除
Type int64 `db:"type"` // 物模型类型 1:property属性 2:event事件 3:action行为
Identifier string `db:"identifier"` // 标识符
Name string `db:"name"` // 功能名称
Desc string `db:"desc"` // 描述
Required int64 `db:"required"` // 是否必须,1是 2否
Affordance string `db:"affordance"` // 各类型的自定义功能定义
CreatedTime time.Time `db:"createdTime"`
UpdatedTime time.Time `db:"updatedTime"`
DeletedTime sql.NullTime `db:"deletedTime"`
}
func ToActionPo ¶
func ToActionPo(productID string, in *schema.Action) *DmProductSchema
func ToPropertyPo ¶
func ToPropertyPo(productID string, in *schema.Property) *DmProductSchema
type DmProductSchemaModel ¶ added in v0.3.0
type DmProductSchemaModel interface {
DeleteWithFilter(ctx context.Context, filter ProductSchemaFilter) error
FindByFilter(ctx context.Context, filter ProductSchemaFilter, page *def.PageInfo) ([]*DmProductSchema, error)
GetCountByFilter(ctx context.Context, filter ProductSchemaFilter) (size int64, err error)
// contains filtered or unexported methods
}
DmProductSchemaModel is an interface to be customized, add more methods here, and implement the added methods in customDmProductSchemaModel.
func NewDmProductSchemaModel ¶ added in v0.3.0
func NewDmProductSchemaModel(conn sqlx.SqlConn) DmProductSchemaModel
NewDmProductSchemaModel returns a model for the database table.
type DmRemoteConfigModel ¶ added in v0.3.0
type DmRemoteConfigModel interface {
Index(ctx context.Context, in *RemoteConfigFilter) ([]*RemoteConfigInfo, int64, error)
GetLastRecord(ctx context.Context, in *RemoteConfigFilter) (*RemoteConfigInfo, error)
}
func NewDmRemoteConfigModel ¶ added in v0.3.0
func NewDmRemoteConfigModel(conn sqlx.SqlConn) DmRemoteConfigModel
type GatewayDeviceFilter ¶ added in v0.3.0
func (GatewayDeviceFilter) FmtSql ¶ added in v0.3.0
func (g GatewayDeviceFilter) FmtSql(sql sq.SelectBuilder) sq.SelectBuilder
type GroupDeviceFilter ¶
type GroupDeviceFilter struct {
Page *def.PageInfo
GroupID int64
ProductID string
DeviceName string
}
func (*GroupDeviceFilter) FmtSql ¶
func (g *GroupDeviceFilter) FmtSql(sql sq.SelectBuilder) sq.SelectBuilder
type GroupFilter ¶
type GroupFilter struct {
Page *def.PageInfo
ParentID int64
GroupName string
Tags map[string]string
}
func (*GroupFilter) FmtSql ¶
func (g *GroupFilter) FmtSql(sql sq.SelectBuilder, parentFlag bool) sq.SelectBuilder
type GroupInformation ¶ added in v0.3.0
type ProductFilter ¶
type ProductFilter struct {
DeviceType int64
ProductName string
ProductIDs []string
Tags map[string]string
}
func (*ProductFilter) FmtSql ¶
func (p *ProductFilter) FmtSql(sql sq.SelectBuilder) sq.SelectBuilder
type ProductSchemaFilter ¶
type ProductSchemaFilter struct {
ProductID string //产品id 必填
Type int64 //物模型类型 1:property属性 2:event事件 3:action行为
Tag int64 //过滤条件: 物模型标签 1:自定义 2:可选 3:必选
Identifiers []string //过滤标识符列表
}
func (*ProductSchemaFilter) FmtSql ¶
func (p *ProductSchemaFilter) FmtSql(sql sq.SelectBuilder) sq.SelectBuilder
type PropertyDef ¶
type PropertyDef struct {
Define schema.Define `json:"define"` //数据定义
Mode schema.PropertyMode `json:"mode"` //读写类型: 1:r(只读) 2:rw(可读可写)
}
type RemoteConfigFilter ¶ added in v0.3.0
func (*RemoteConfigFilter) FmtSql ¶ added in v0.3.0
func (g *RemoteConfigFilter) FmtSql(sql sq.SelectBuilder) sq.SelectBuilder
Source Files
¶
- assemble.go
- dmdeviceinfomodel.go
- dmdeviceinfomodel_gen.go
- dmgatewaydevicemodel.go
- dmgatewaydevicemodel_gen.go
- dmgroupdevicemodel.go
- dmgroupdevicemodel_gen.go
- dmgroupinfomodel.go
- dmgroupinfomodel_gen.go
- dmgroupmodel.go
- dmproductfirmwaremodel.go
- dmproductfirmwaremodel_gen.go
- dmproductinfomodel.go
- dmproductinfomodel_gen.go
- dmproductremoteconfigmodel.go
- dmproductremoteconfigmodel_gen.go
- dmproductschemamodel.go
- dmproductschemamodel_gen.go
- dmremoteconfigmodel.go
- vars.go