model

package
v0.0.0-...-592b0ac Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDuplicate = errors.New("sql: duplicate key")
View Source
var ErrNotFound = sqlx.ErrNotFound

Functions

This section is empty.

Types

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 sql.NullTime `db:"updatedTime"`
	DeletedTime sql.NullTime `db:"deletedTime"`
	Version     string       `db:"version"`  // 固件版本
	LogLevel    int64        `db:"logLevel"` // 日志级别:1)关闭 2)错误 3)告警 4)信息 5)调试
	Cert        string       `db:"cert"`     // 设备证书
}

type DeviceInfoModel

type DeviceInfoModel interface {
	Insert(data DeviceInfo) (sql.Result, error)
	FindOne(id int64) (*DeviceInfo, error)
	FindOneByProductIDDeviceName(productID string, deviceName string) (*DeviceInfo, error)
	Update(data DeviceInfo) error
	Delete(id int64) error
}

func NewDeviceInfoModel

func NewDeviceInfoModel(conn sqlx.SqlConn, c cache.CacheConf) DeviceInfoModel

type DeviceLog

type DeviceLog struct {
	Id          int64     `db:"id"`
	ProductID   string    `db:"productID"`  // 产品id
	Action      string    `db:"action"`     // 操作类型
	Timestamp   time.Time `db:"timestamp"`  // 操作时间
	DeviceName  string    `db:"deviceName"` // 设备名称
	Payload     string    `db:"payload"`    // 具体信息
	Topic       string    `db:"topic"`      // 主题
	CreatedTime time.Time `db:"createdTime"`
}

type DeviceLogModel

type DeviceLogModel interface {
	Insert(data DeviceLog) (sql.Result, error)
	FindOne(id int64) (*DeviceLog, error)
	Update(data DeviceLog) error
	Delete(id int64) error
}

func NewDeviceLogModel

func NewDeviceLogModel(conn sqlx.SqlConn) DeviceLogModel

type DmModel

type DmModel interface {
	FindByProductInfo(page def.PageInfo) ([]*ProductInfo, error)
	FindByProductID(productID string, page def.PageInfo) ([]*DeviceInfo, error)
	GetCountByProductID(productID string) (size int64, err error)
	GetCountByProductInfo() (size int64, err error)
}

func NewDmModel

func NewDmModel(conn sqlx.SqlConn, c cache.CacheConf) DmModel

type ProductInfo

type ProductInfo struct {
	Id           int64        `db:"id"`
	ProductID    string       `db:"productID"`    // 产品id
	Template     string       `db:"template"`     // 数据模板
	ProductName  string       `db:"productName"`  // 产品名称
	ProductType  int64        `db:"productType"`  // 产品状态:0:开发中,1:审核中,2:已发布
	AuthMode     int64        `db:"authMode"`     // 认证方式:0:账密认证,1:秘钥认证
	DeviceType   int64        `db:"deviceType"`   // 设备类型:0:设备,1:网关,2:子设备
	CategoryID   int64        `db:"categoryID"`   // 产品品类
	NetType      int64        `db:"netType"`      // 通讯方式:0:其他,1:wi-fi,2:2G/3G/4G,3:5G,4:BLE,5:LoRaWAN
	DataProto    int64        `db:"dataProto"`    // 数据协议:0:自定义,1:数据模板
	AutoRegister int64        `db:"autoRegister"` // 动态注册:0:关闭,1:打开,2:打开并自动创建设备
	Secret       string       `db:"secret"`       // 动态注册产品秘钥
	Description  string       `db:"description"`  // 描述
	CreatedTime  time.Time    `db:"createdTime"`
	UpdatedTime  sql.NullTime `db:"updatedTime"`
	DeletedTime  sql.NullTime `db:"deletedTime"`
	DevStatus    string       `db:"devStatus"` // 产品状态
}

type ProductInfoModel

type ProductInfoModel interface {
	Insert(data ProductInfo) (sql.Result, error)
	FindOne(id int64) (*ProductInfo, error)
	FindOneByProductID(productID string) (*ProductInfo, error)
	FindOneByProductName(productName string) (*ProductInfo, error)
	Update(data ProductInfo) error
	Delete(id int64) error
}

func NewProductInfoModel

func NewProductInfoModel(conn sqlx.SqlConn, c cache.CacheConf) ProductInfoModel

Jump to

Keyboard shortcuts

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