Documentation
¶
Index ¶
- Variables
- func NewProductSchemaModel(conn sqlx.SqlConn) *customProductSchemaModel
- func ToActionDo(in *ProductSchema) *schema.Action
- func ToEventDo(in *ProductSchema) *schema.Event
- func ToPropertyDo(in *ProductSchema) *schema.Property
- func ToSchemaDo(in []*ProductSchema) *schema.Model
- type ActionDef
- type DeviceFilter
- type DeviceInfo
- type DeviceInfoModel
- type EventDef
- type GroupDevice
- type GroupDeviceFilter
- type GroupDeviceModel
- type GroupFilter
- type GroupInfo
- type GroupInfoModel
- type GroupModel
- type ProductFilter
- type ProductFirmware
- type ProductFirmwareModel
- type ProductInfo
- type ProductInfoModel
- type ProductSchema
- type ProductSchemaFilter
- type ProductSchemaModel
- type PropertyDef
Constants ¶
This section is empty.
Variables ¶
var ErrDuplicate = errors.New("sql: duplicate key")
var ErrNotFound = sqlx.ErrNotFound
Functions ¶
func NewProductSchemaModel ¶
NewProductSchemaModel returns a model for the database table.
func ToActionDo ¶
func ToActionDo(in *ProductSchema) *schema.Action
func ToEventDo ¶
func ToEventDo(in *ProductSchema) *schema.Event
func ToPropertyDo ¶
func ToPropertyDo(in *ProductSchema) *schema.Property
func ToSchemaDo ¶
func ToSchemaDo(in []*ProductSchema) *schema.Model
Types ¶
type DeviceFilter ¶
func (*DeviceFilter) FmtSql ¶
func (d *DeviceFilter) FmtSql(sql sq.SelectBuilder) sq.SelectBuilder
type DeviceInfo ¶
type DeviceInfo 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"` // 设备标签
}
type DeviceInfoModel ¶
type DeviceInfoModel interface {
FindByFilter(ctx context.Context, filter DeviceFilter, page def.PageInfo) ([]*DeviceInfo, error)
CountByFilter(ctx context.Context, filter DeviceFilter) (size int64, err error)
// contains filtered or unexported methods
}
DeviceInfoModel is an interface to be customized, add more methods here, and implement the added methods in customDeviceInfoModel.
func NewDeviceInfoModel ¶
func NewDeviceInfoModel(conn sqlx.SqlConn) DeviceInfoModel
NewDeviceInfoModel returns a model for the database table.
type GroupDevice ¶
type GroupDevice 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 GroupDeviceFilter ¶
type GroupDeviceFilter struct {
GroupID int64
DeviceName string
// contains filtered or unexported fields
}
func (*GroupDeviceFilter) FmtSql ¶
func (g *GroupDeviceFilter) FmtSql(sql sq.SelectBuilder) sq.SelectBuilder
type GroupDeviceModel ¶
type GroupDeviceModel interface {
// contains filtered or unexported methods
}
GroupDeviceModel is an interface to be customized, add more methods here, and implement the added methods in customGroupDeviceModel.
func NewGroupDeviceModel ¶
func NewGroupDeviceModel(conn sqlx.SqlConn) GroupDeviceModel
NewGroupDeviceModel returns a model for the database table.
type GroupFilter ¶
func (*GroupFilter) FmtSql ¶
func (g *GroupFilter) FmtSql(sql sq.SelectBuilder, parentFlag bool) sq.SelectBuilder
type GroupInfo ¶
type GroupInfo 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 GroupInfoModel ¶
type GroupInfoModel interface {
// contains filtered or unexported methods
}
GroupInfoModel is an interface to be customized, add more methods here, and implement the added methods in customGroupInfoModel.
func NewGroupInfoModel ¶
func NewGroupInfoModel(conn sqlx.SqlConn) GroupInfoModel
NewGroupInfoModel returns a model for the database table.
type GroupModel ¶
type GroupModel interface {
Index(ctx context.Context, in *dm.GroupInfoIndexReq) ([]*dm.GroupInfo, int64, error)
IndexAll(ctx context.Context, in *dm.GroupInfoIndexReq) ([]*dm.GroupInfo, error)
IndexGD(ctx context.Context, in *dm.GroupDeviceIndexReq) ([]*GroupDevice, int64, error)
Delete(ctx context.Context, groupID int64) error
GroupDeviceCreate(ctx context.Context, groupID int64, list []*dm.DeviceInfoReadReq) error
GroupDeviceDelete(ctx context.Context, groupID int64, list map[string]string) error
}
func NewGroupModel ¶
func NewGroupModel(conn sqlx.SqlConn, c cache.CacheConf) GroupModel
type ProductFilter ¶
func (*ProductFilter) FmtSql ¶
func (p *ProductFilter) FmtSql(sql sq.SelectBuilder) sq.SelectBuilder
type ProductFirmware ¶
type ProductFirmware 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 ProductFirmwareModel ¶
type ProductFirmwareModel interface {
// contains filtered or unexported methods
}
ProductFirmwareModel is an interface to be customized, add more methods here, and implement the added methods in customProductFirmwareModel.
func NewProductFirmwareModel ¶
func NewProductFirmwareModel(conn sqlx.SqlConn) ProductFirmwareModel
NewProductFirmwareModel returns a model for the database table.
type ProductInfo ¶
type ProductInfo 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"` // 产品状态
}
type ProductInfoModel ¶
type ProductInfoModel interface {
FindByFilter(ctx context.Context, filter ProductFilter, page def.PageInfo) ([]*ProductInfo, error)
CountByFilter(ctx context.Context, filter ProductFilter) (size int64, err error)
// contains filtered or unexported methods
}
ProductInfoModel is an interface to be customized, add more methods here, and implement the added methods in customProductInfoModel.
func NewProductInfoModel ¶
func NewProductInfoModel(conn sqlx.SqlConn) ProductInfoModel
NewProductInfoModel returns a model for the database table.
type ProductSchema ¶
type ProductSchema 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) *ProductSchema
func ToPropertyPo ¶
func ToPropertyPo(productID string, in *schema.Property) *ProductSchema
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 ProductSchemaModel ¶
type ProductSchemaModel interface {
DeleteWithFilter(ctx context.Context, filter ProductSchemaFilter) error
FindByFilter(ctx context.Context, filter ProductSchemaFilter, page def.PageInfo) ([]*ProductSchema, error)
GetCountByFilter(ctx context.Context, filter ProductSchemaFilter) (size int64, err error)
// contains filtered or unexported methods
}
type PropertyDef ¶
type PropertyDef struct {
Define schema.Define `json:"define"` //数据定义
Mode schema.PropertyMode `json:"mode"` //读写类型: 1:r(只读) 2:rw(可读可写)
}