Documentation
¶
Index ¶
- Variables
- func NewTlsConfig(sslPath string) *tls.Config
- func ReadIP4() []string
- func ReadIP4WithPrefix(prefix string) []string
- func ReadIP4WithPrefixFirst(prefix string) string
- type AlarmCacheUtil
- type ChainedCache
- type ConfigHelper
- func (the *ConfigHelper) DeleteChainedCacheObj(k string) error
- func (the *ConfigHelper) GetAggThreshold(structId int, factorId int) (*common_models.AggThreshold, error)
- func (the *ConfigHelper) GetAlarmCode(alarmCode string) (common_models.AlarmCode, error)
- func (the *ConfigHelper) GetCacheWindowObj(key_cacheWindow string) (common_models.CacheWindow, error)
- func (the *ConfigHelper) GetDataUnit() ([]common_models.DataUnit, error)
- func (the *ConfigHelper) GetDeviceFactorProto(factorProtoId, deviceMetaId string) (common_models.DeviceFactorProto, error)
- func (the *ConfigHelper) GetDeviceInfo(deviceId string, forceUpdate bool) (*common_models.DeviceInfo, error)
- func (the *ConfigHelper) GetDeviceStationIds(deviceId string) ([]int, error)
- func (the *ConfigHelper) GetDeviceStationObjs(deviceId string) ([]common_models.Station, error)
- func (the *ConfigHelper) GetFactorInfo(factorId int) (common_models.Factor, error)
- func (the *ConfigHelper) GetFilter(stationId int) (common_models.Filter, error)
- func (the *ConfigHelper) GetFilterItem(stationId int, item string) (common_models.FilterItem, error)
- func (the *ConfigHelper) GetFormulaInfo(formulaId int) (common_models.Formula, error)
- func (the *ConfigHelper) GetIotaDevice(deviceId string) (common_models.IotaDevice, error)
- func (the *ConfigHelper) GetIotaMeta(deviceId string) (common_models.DeviceMeta, error)
- func (the *ConfigHelper) GetIotaScheme(dimensionId string) (common_models.IotaScheme, error)
- func (the *ConfigHelper) GetProto(protoCode string) (common_models.Proto, error)
- func (the *ConfigHelper) GetStationCorrGroups(stationId int) ([]common_models.StationGroup, error)
- func (the *ConfigHelper) GetStationGroup(groupId int) (common_models.StationGroup, error)
- func (the *ConfigHelper) GetStationGroupInfo(stationId int) (common_models.StationGroupInfo, error)
- func (the *ConfigHelper) GetStationInfo(stationId int) (common_models.StationInfo, error)
- func (the *ConfigHelper) GetStationThreshold(stationId int) (*common_models.Threshold, error)
- func (the *ConfigHelper) GetStations(stationIds ...int) ([]common_models.Station, error)
- func (the *ConfigHelper) GetStructure(structId int) (common_models.Structure, error)
- func (the *ConfigHelper) GetSubDeviceAll(deviceId, thingId string) (subDeviceIds []string)
- func (the *ConfigHelper) GetSubDeviceNext(deviceId, thingId string) (subDeviceIds []string)
- func (the *ConfigHelper) GetThingStruct(deviceId string) (common_models.ThingStruct, error)
- func (the *ConfigHelper) SAddAlarm(key string, alarmTypes ...string) int64
- func (the *ConfigHelper) SRemAlarm(key string, alarmTypes ...string) int64
- func (the *ConfigHelper) SetAggThreshold(structId int, factorId int, threshold common_models.AggThreshold) error
- func (the *ConfigHelper) SetChainedCacheObj(k string, obj any) error
- func (the *ConfigHelper) SetChainedCacheObjWithExpiration(k string, obj any, duration time.Duration) error
- func (the *ConfigHelper) SetDeviceStationObjs(deviceId string, stations common_models.StationArrayObj) error
- func (the *ConfigHelper) SetFactorInfo(factorId int, factor common_models.Factor) error
- func (the *ConfigHelper) SetIotaScheme(dimensionId string, scheme common_models.IotaScheme) error
- func (the *ConfigHelper) SetStationCorrGroup(stationId int, groupIds []int) error
- func (the *ConfigHelper) SetStationGroup(groupId int, group common_models.StationGroup) error
- func (the *ConfigHelper) SetStationGroupInfo(stationId int, info common_models.StationGroupInfo) error
- func (the *ConfigHelper) SetStationInfo(stationId int, station common_models.StationInfo) error
- func (the *ConfigHelper) SetStationThreshold(stationId int, threshold common_models.Threshold) error
- func (the *ConfigHelper) StartUpdateDeviceInfo(interval time.Duration, batchSize int)
- type MqttHelper
- type RedisHelper
- func (the *RedisHelper) Get(key string) string
- func (the *RedisHelper) GetLRange(keys string, addr any) error
- func (the *RedisHelper) GetObj(keys string, addr any) error
- func (the *RedisHelper) HMGetObj(addr any, key, field string) error
- func (the *RedisHelper) InitialCluster(master string, address ...string)
- func (the *RedisHelper) InitialCluster_old(master string, address ...string)
- func (the *RedisHelper) MGetObj(addr any, keys ...string) error
- func (the *RedisHelper) SAdd(key string, members ...string) int64
- func (the *RedisHelper) SRem(key string, members ...string) int64
- func (the *RedisHelper) SetObj(keys string, obj any) error
- type UnitHelper
Constants ¶
This section is empty.
Variables ¶
View Source
var AlarmCodeCache map[string]common_models.AlarmCode
View Source
var DeviceInfoCache map[string]common_models.DeviceInfo
View Source
var DeviceNodeCache map[string]common_models.IotaInstances
View Source
var FormulaCache map[int]common_models.Formula
View Source
var IotaDeviceCache map[string]common_models.IotaDevice
View Source
var ProtoCache map[string]common_models.Proto
View Source
var StructureCache map[int]common_models.Structure
Functions ¶
func NewTlsConfig ¶
func ReadIP4WithPrefix ¶
ReadIP4WithPrefix ReadIP4 获取ipV4 过滤网段 prefix
func ReadIP4WithPrefixFirst ¶
ReadIP4WithPrefixFirst 获取ipV4 过滤网段 prefix
Types ¶
type AlarmCacheUtil ¶
type AlarmCacheUtil struct {
AlarmCachePerfix string
ALARM_SOURCE_DEVICE int
ALARM_SOURCE_STATION int
// contains filtered or unexported fields
}
func NewAlarmCacheUtil ¶
func NewAlarmCacheUtil() *AlarmCacheUtil
type ChainedCache ¶
type ChainedCache struct {
LoadableChinCache *cache.LoadableCache[any]
}
func NewChainedCache ¶
func NewChainedCache(redisAddr string) *ChainedCache
type ConfigHelper ¶
type ConfigHelper struct {
// contains filtered or unexported fields
}
func NewConfigHelper ¶
func NewConfigHelper(redisAddr string) *ConfigHelper
func (*ConfigHelper) DeleteChainedCacheObj ¶ added in v0.0.11
func (the *ConfigHelper) DeleteChainedCacheObj(k string) error
func (*ConfigHelper) GetAggThreshold ¶
func (the *ConfigHelper) GetAggThreshold(structId int, factorId int) (*common_models.AggThreshold, error)
func (*ConfigHelper) GetAlarmCode ¶
func (the *ConfigHelper) GetAlarmCode(alarmCode string) (common_models.AlarmCode, error)
func (*ConfigHelper) GetCacheWindowObj ¶
func (the *ConfigHelper) GetCacheWindowObj(key_cacheWindow string) (common_models.CacheWindow, error)
func (*ConfigHelper) GetDataUnit ¶
func (the *ConfigHelper) GetDataUnit() ([]common_models.DataUnit, error)
func (*ConfigHelper) GetDeviceFactorProto ¶
func (the *ConfigHelper) GetDeviceFactorProto(factorProtoId, deviceMetaId string) (common_models.DeviceFactorProto, error)
func (*ConfigHelper) GetDeviceInfo ¶
func (the *ConfigHelper) GetDeviceInfo(deviceId string, forceUpdate bool) (*common_models.DeviceInfo, error)
func (*ConfigHelper) GetDeviceStationIds ¶
func (the *ConfigHelper) GetDeviceStationIds(deviceId string) ([]int, error)
func (*ConfigHelper) GetDeviceStationObjs ¶
func (the *ConfigHelper) GetDeviceStationObjs(deviceId string) ([]common_models.Station, error)
func (*ConfigHelper) GetFactorInfo ¶
func (the *ConfigHelper) GetFactorInfo(factorId int) (common_models.Factor, error)
func (*ConfigHelper) GetFilter ¶
func (the *ConfigHelper) GetFilter(stationId int) (common_models.Filter, error)
func (*ConfigHelper) GetFilterItem ¶ added in v0.0.11
func (the *ConfigHelper) GetFilterItem(stationId int, item string) (common_models.FilterItem, error)
func (*ConfigHelper) GetFormulaInfo ¶
func (the *ConfigHelper) GetFormulaInfo(formulaId int) (common_models.Formula, error)
func (*ConfigHelper) GetIotaDevice ¶
func (the *ConfigHelper) GetIotaDevice(deviceId string) (common_models.IotaDevice, error)
func (*ConfigHelper) GetIotaMeta ¶
func (the *ConfigHelper) GetIotaMeta(deviceId string) (common_models.DeviceMeta, error)
func (*ConfigHelper) GetIotaScheme ¶
func (the *ConfigHelper) GetIotaScheme(dimensionId string) (common_models.IotaScheme, error)
func (*ConfigHelper) GetProto ¶
func (the *ConfigHelper) GetProto(protoCode string) (common_models.Proto, error)
func (*ConfigHelper) GetStationCorrGroups ¶
func (the *ConfigHelper) GetStationCorrGroups(stationId int) ([]common_models.StationGroup, error)
func (*ConfigHelper) GetStationGroup ¶
func (the *ConfigHelper) GetStationGroup(groupId int) (common_models.StationGroup, error)
func (*ConfigHelper) GetStationGroupInfo ¶
func (the *ConfigHelper) GetStationGroupInfo(stationId int) (common_models.StationGroupInfo, error)
func (*ConfigHelper) GetStationInfo ¶
func (the *ConfigHelper) GetStationInfo(stationId int) (common_models.StationInfo, error)
func (*ConfigHelper) GetStationThreshold ¶
func (the *ConfigHelper) GetStationThreshold(stationId int) (*common_models.Threshold, error)
func (*ConfigHelper) GetStations ¶
func (the *ConfigHelper) GetStations(stationIds ...int) ([]common_models.Station, error)
func (*ConfigHelper) GetStructure ¶ added in v0.0.8
func (the *ConfigHelper) GetStructure(structId int) (common_models.Structure, error)
func (*ConfigHelper) GetSubDeviceAll ¶
func (the *ConfigHelper) GetSubDeviceAll(deviceId, thingId string) (subDeviceIds []string)
func (*ConfigHelper) GetSubDeviceNext ¶
func (the *ConfigHelper) GetSubDeviceNext(deviceId, thingId string) (subDeviceIds []string)
获取指定设备节点下的级联设备(递归)(不包含当前设备节点)
func (*ConfigHelper) GetThingStruct ¶
func (the *ConfigHelper) GetThingStruct(deviceId string) (common_models.ThingStruct, error)
func (*ConfigHelper) SAddAlarm ¶
func (the *ConfigHelper) SAddAlarm(key string, alarmTypes ...string) int64
SAddAlarm 添加Alarm缓存
func (*ConfigHelper) SRemAlarm ¶
func (the *ConfigHelper) SRemAlarm(key string, alarmTypes ...string) int64
func (*ConfigHelper) SetAggThreshold ¶
func (the *ConfigHelper) SetAggThreshold(structId int, factorId int, threshold common_models.AggThreshold) error
func (*ConfigHelper) SetChainedCacheObj ¶
func (the *ConfigHelper) SetChainedCacheObj(k string, obj any) error
func (*ConfigHelper) SetChainedCacheObjWithExpiration ¶
func (*ConfigHelper) SetDeviceStationObjs ¶
func (the *ConfigHelper) SetDeviceStationObjs(deviceId string, stations common_models.StationArrayObj) error
func (*ConfigHelper) SetFactorInfo ¶
func (the *ConfigHelper) SetFactorInfo(factorId int, factor common_models.Factor) error
func (*ConfigHelper) SetIotaScheme ¶
func (the *ConfigHelper) SetIotaScheme(dimensionId string, scheme common_models.IotaScheme) error
RedisKey.Scheme
func (*ConfigHelper) SetStationCorrGroup ¶
func (the *ConfigHelper) SetStationCorrGroup(stationId int, groupIds []int) error
RedisKey.station_corr_group
func (*ConfigHelper) SetStationGroup ¶
func (the *ConfigHelper) SetStationGroup(groupId int, group common_models.StationGroup) error
RedisKey.group
func (*ConfigHelper) SetStationGroupInfo ¶
func (the *ConfigHelper) SetStationGroupInfo(stationId int, info common_models.StationGroupInfo) error
RedisKey.station_group
func (*ConfigHelper) SetStationInfo ¶
func (the *ConfigHelper) SetStationInfo(stationId int, station common_models.StationInfo) error
func (*ConfigHelper) SetStationThreshold ¶
func (the *ConfigHelper) SetStationThreshold(stationId int, threshold common_models.Threshold) error
func (*ConfigHelper) StartUpdateDeviceInfo ¶ added in v0.0.14
func (the *ConfigHelper) StartUpdateDeviceInfo(interval time.Duration, batchSize int)
定时更新设备信息
type MqttHelper ¶
type MqttHelper struct {
Host string
Port int
ClientId string
UserName string
Password string
// contains filtered or unexported fields
}
func NewMqttHelper ¶
func (*MqttHelper) Initial ¶
func (the *MqttHelper) Initial()
func (*MqttHelper) InitialWithSSL ¶
func (the *MqttHelper) InitialWithSSL(caPath string)
func (*MqttHelper) Publish ¶
func (the *MqttHelper) Publish(topic string, messageBytes []byte)
type RedisHelper ¶
type RedisHelper struct {
// contains filtered or unexported fields
}
func NewRedisHelper ¶
func NewRedisHelper(master string, address ...string) *RedisHelper
func (*RedisHelper) Get ¶
func (the *RedisHelper) Get(key string) string
func (*RedisHelper) InitialCluster ¶
func (the *RedisHelper) InitialCluster(master string, address ...string)
func (*RedisHelper) InitialCluster_old ¶ added in v0.0.13
func (the *RedisHelper) InitialCluster_old(master string, address ...string)
type UnitHelper ¶
type UnitHelper struct {
// contains filtered or unexported fields
}
func NewUnitHelper ¶
func NewUnitHelper(configHelper *ConfigHelper) *UnitHelper
func NewUnitHelperWithConfig ¶
func NewUnitHelperWithConfig(configHelper *ConfigHelper) *UnitHelper
func (*UnitHelper) GetUnitTransK ¶
func (the *UnitHelper) GetUnitTransK(from, to string) float64
Source Files
¶
Click to show internal directories.
Click to hide internal directories.