helper

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CoreCache coreCache

CoreCache 核心缓存

View Source
var Crontab crontab.Crontab // 全局定时任务实例
View Source
var DeviceShadow shadow.DeviceShadow // 本地设备影子
View Source
var EnvConfig config.EnvConfig
View Source
var Logger *zap.Logger

Logger 日志记录器

View Source
var PluginCacheMap = &sync.Map{} // 插件通用缓存

Functions

func CallLuaConverter

func CallLuaConverter(L *glua.LState, method string, raw interface{}) ([]plugin.DeviceData, error)

CallLuaConverter 调用 Lua 脚本转换器

func CallLuaEncodeConverter

func CallLuaEncodeConverter(L *glua.LState, deviceSn string, raw interface{}) (string, error)

CallLuaEncodeConverter 调用 Lua 脚本编码转换器

func CallLuaMethod added in v0.6.0

func CallLuaMethod(L *glua.LState, method string, args ...glua.LValue) (string, error)

执行指定lua方法

func Close added in v0.6.0

func Close(L *glua.LState)

关闭Lua虚拟机

func Conv2Float64

func Conv2Float64(value interface{}) (f float64, err error)

Conv2Float64 转换为 float64 类型

func Conv2Int64

func Conv2Int64(value interface{}) (i int64, err error)

Conv2Int64 转换为 int64 类型

func Conv2String

func Conv2String(value interface{}) (s string, err error)

Conv2String 转换为 string 类型

func Conv2Struct added in v1.0.0

func Conv2Struct(from any, to any) error

func ConvPointType

func ConvPointType(value interface{}, valueType config.ValueType) (interface{}, error)

ConvPointType 点位类型转换 仅支持三种数据类型:int、float、string

func InitCoreCache

func InitCoreCache(configMap map[string]config.Config) (err error)

InitCoreCache 初始化核心缓存

func InitLogger

func InitLogger(level string) (err error)

New 实例化

func Map2Struct

func Map2Struct(m interface{}, v interface{}) error

Map2Struct map 转 struct,用于解析连接器配置 m:map[string]interface v:&struct{}

func ScriptExists added in v0.8.0

func ScriptExists(dir string) bool

scriptExists 判断lua脚本是否存在

Types

type DeviceProperties added in v0.6.0

type DeviceProperties map[string]string

type LuaModule

type LuaModule struct{}

LuaModule go 实现 lua 模块,供脚本内使用

var LuaModuleInstance *LuaModule

func (*LuaModule) GetCache

func (lm *LuaModule) GetCache(L *lua.LState) int

GetCache 获取缓存

func (*LuaModule) Loader

func (lm *LuaModule) Loader(L *lua.LState) int

Loader 模块预加载

func (*LuaModule) SetCache

func (lm *LuaModule) SetCache(L *lua.LState) int

SetCache 设置缓存

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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