Documentation
¶
Index ¶
- func RunUnsafeCode(vm *otto.Otto, code string, timeOut time.Duration) (value otto.Value, err error)
- type Adapter
- type AppStorage
- type Functions
- func (f *Functions) Convert(data map[string]interface{}) (map[string]interface{}, error)
- func (f *Functions) Decode(payload []byte) (map[string]interface{}, error)
- func (f *Functions) Process(payload []byte) (map[string]interface{}, bool, error)
- func (f *Functions) Validate(data map[string]interface{}) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter interface {
core.AppClient
Storage() AppStorage
SubscribeDownlink(handler core.HandlerServer) error
}
Adapter represents the interface of an application
func NewAdapter ¶
NewAdapter returns a new adapter that processes binary payload to fields
type AppStorage ¶
type AppStorage interface {
SetFunctions(eui types.AppEUI, functions *Functions) error
GetFunctions(eui types.AppEUI) (*Functions, error)
Reset() error
Close() error
}
AppStorage provides storage for applications
func ConnectRedis ¶
func ConnectRedis(addr string, db int64) (AppStorage, error)
ConnectRedis connects to Redis using the specified options
type Functions ¶
type Functions struct {
// Decoder is a JavaScript function that accepts the payload as byte array and
// returns an object containing the decoded values
Decoder string
// Converter is a JavaScript function that accepts the data as decoded by
// Decoder and returns an object containing the converted values
Converter string
// Validator is a JavaScript function that validates the data is converted by
// Converter and returns a boolean value indicating the validity of the data
Validator string
}
Functions decodes, converts and validates payload using JavaScript functions
func (*Functions) Convert ¶
Convert converts the values in the specified map to a another map using the Converter function. If the Converter function is not set, this function returns the data as-is
Click to show internal directories.
Click to hide internal directories.