Documentation
¶
Index ¶
- Constants
- func CountDeviceOnlineNum() (num int)
- func GetAllDeviceList() (outList []*model.DeviceOutput, err error)
- func GetConfigByKey(ctx context.Context, key string) (value any, err error)
- func GetDataByPage(ctx context.Context, deviceKey string, pageNum, pageSize int, ...) (res []string, total, currentPage int, err error)
- func GetDeviceAlarm(ctx context.Context, productKey string) (out []model.AlarmRuleOutput)
- func GetDeviceDetailData(ctx context.Context, deviceKey string, dataType ...string) (res []map[string]iotModel.ReportPropertyNode)
- func GetDeviceDetailDataByLatest(ctx context.Context, deviceKey string) (res iotModel.ReportPropertyData)
- func GetDeviceDetailDataByPage(ctx context.Context, deviceKey string, pageNum, pageSize int, ...) (res []map[string]iotModel.ReportPropertyNode, total, currentPage int)
- func GetDeviceDetailInfo(deviceKey string) (out *model.DeviceOutput, err error)
- func GetDeviceStatus(ctx context.Context, deviceKey string) (res int)
- func GetOnlineDeviceList() (list g.Slice, err error)
- func GetProductDetailInfo(productKey string) (out *model.DetailProductOutput, err error)
- func InertDeviceLog(ctx context.Context, logType, deviceKey string, obj interface{})
- func InitSystemConfig(ctx context.Context) (err error)
- func SearchKey(keyword string) (keys []string, err error)
- func SetConfigByKey(ctx context.Context, configKey string, configValue any) (value any, err error)
- func SetDeviceAlarmRule(ctx context.Context, productKey string, data []model.AlarmRuleOutput) (err error)
- func SetDeviceDetailInfo(deviceKey string, data *model.DeviceOutput) (err error)
- func SetProductDetailInfo(productKey string, data *model.DetailProductOutput) (err error)
- func UpdateStatus(ctx context.Context, device *model.DeviceOutput)
- type DataProcessor
- type RedisManager
- func (r *RedisManager) GetClient() *redis.Client
- func (r *RedisManager) GetData(ctx context.Context, key string) ([]string, error)
- func (r *RedisManager) GetDataByLatest(ctx context.Context, key string) (string, error)
- func (r *RedisManager) InsertBatchData(ctx context.Context, key string, data []interface{}) error
- func (r *RedisManager) InsertData(ctx context.Context, key string, data interface{}) error
- func (r *RedisManager) ListenForNewData(ctx context.Context, key string, processor DataProcessor, ...)
Constants ¶
const DeviceDataCachePrefix = "deviceCacheData:"
Variables ¶
This section is empty.
Functions ¶
func GetAllDeviceList ¶
func GetAllDeviceList() (outList []*model.DeviceOutput, err error)
GetAllDeviceList 获取缓存中的所有设备列表
func GetConfigByKey ¶
GetConfigByKey 获取系统参数配置
func GetDataByPage ¶
func GetDataByPage(ctx context.Context, deviceKey string, pageNum, pageSize int, types, dateRange []string) (res []string, total, currentPage int, err error)
GetDataByPage 按分页获取数据,增加按字段内容搜索和时间区间搜索
func GetDeviceAlarm ¶
func GetDeviceAlarm(ctx context.Context, productKey string) (out []model.AlarmRuleOutput)
GetDeviceAlarm 基于产品key获取设备告警规则
func GetDeviceDetailData ¶
func GetDeviceDetailData(ctx context.Context, deviceKey string, dataType ...string) (res []map[string]iotModel.ReportPropertyNode)
GetDeviceDetailData 获取设备解析后的详细数据
func GetDeviceDetailDataByLatest ¶
func GetDeviceDetailDataByLatest(ctx context.Context, deviceKey string) (res iotModel.ReportPropertyData)
GetDeviceDetailDataByLatest 获取设备解析后的最新一条数据
func GetDeviceDetailDataByPage ¶
func GetDeviceDetailDataByPage(ctx context.Context, deviceKey string, pageNum, pageSize int, dataType ...string) (res []map[string]iotModel.ReportPropertyNode, total, currentPage int)
GetDeviceDetailDataByPage 按分页获取设备详细数据,分页参数: pageNum 为页码, pageSize 为每页数量
func GetDeviceDetailInfo ¶
func GetDeviceDetailInfo(deviceKey string) (out *model.DeviceOutput, err error)
GetDeviceDetailInfo 获取设备详情缓存
func GetDeviceStatus ¶
GetDeviceStatus 获取指定的设备状态
func GetOnlineDeviceList ¶
GetOnlineDeviceList 获取在线设备列表
func GetProductDetailInfo ¶
func GetProductDetailInfo(productKey string) (out *model.DetailProductOutput, err error)
GetProductDetailInfo 获取产品详情缓存
func InertDeviceLog ¶
InertDeviceLog 插入设备日志
func InitSystemConfig ¶
InitSystemConfig 初始化系统参数配置
func SetConfigByKey ¶
SetConfigByKey 设置系统参数配置
func SetDeviceAlarmRule ¶
func SetDeviceAlarmRule(ctx context.Context, productKey string, data []model.AlarmRuleOutput) (err error)
SetDeviceAlarmRule 基于产品key设置设备告警规则
func SetDeviceDetailInfo ¶
func SetDeviceDetailInfo(deviceKey string, data *model.DeviceOutput) (err error)
SetDeviceDetailInfo 设置设备详情缓存
func SetProductDetailInfo ¶
func SetProductDetailInfo(productKey string, data *model.DetailProductOutput) (err error)
SetProductDetailInfo 设置产品详情缓存
func UpdateStatus ¶
func UpdateStatus(ctx context.Context, device *model.DeviceOutput)
UpdateStatus 更新设备状态
Types ¶
type RedisManager ¶
type RedisManager struct {
// contains filtered or unexported fields
}
RedisManager 管理Redis操作和连接池
func (*RedisManager) GetClient ¶
func (r *RedisManager) GetClient() *redis.Client
GetClient 获取Redis客户端
func (*RedisManager) GetDataByLatest ¶
GetDataByLatest 获取最新的一条数据
func (*RedisManager) InsertBatchData ¶
func (r *RedisManager) InsertBatchData(ctx context.Context, key string, data []interface{}) error
InsertBatchData 批量插入数据
func (*RedisManager) InsertData ¶
func (r *RedisManager) InsertData(ctx context.Context, key string, data interface{}) error
InsertData 插入单条数据
func (*RedisManager) ListenForNewData ¶
func (r *RedisManager) ListenForNewData(ctx context.Context, key string, processor DataProcessor, interval time.Duration)
ListenForNewData 监听指定的 Redis key,对新数据执行处理函数,interval为轮询间隔