binding

package
v0.0.0-...-d5a0809 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Overview

Package binding provides extended sources of data binding.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONValue

type JSONValue interface {
	binding.DataItem

	GetItemString(firstParam interface{}, params ...interface{}) (binding.String, error)
	GetItemFloat(firstParam interface{}, params ...interface{}) (binding.Float, error)
	GetItemInt(firstParam interface{}, params ...interface{}) (binding.Int, error)
	GetItemBool(firstParam interface{}, params ...interface{}) (binding.Bool, error)

	IsEmpty() bool
}

JSONValue supports binding a JSON object

func NewJSONFromString

func NewJSONFromString(data binding.String) (JSONValue, error)

NewJSONFromString return a data binding to a JSON object synchronized with the `String` binding used to create the new binding. The JSON object is not exposed. You have to get children data binding targeting a specific path to actually get a data out of that JSON.

type StringCloser

type StringCloser interface {
	binding.String
	io.Closer
}

StringCloser is an extension of the String interface that allows resources to be freed using the standard `Close()` method.

func NewMqttString

func NewMqttString(conn mqtt.Client, topic string) (StringCloser, error)

NewMqttString returns a `String` binding to a MQTT topic specified by combining a connected mqtt.Client and a `topic`. The resulting string will be set to the content of the latest message sent through the socket. You should also call `Close()` on the binding once you are done to free the connection.

func NewWebSocketString

func NewWebSocketString(url string) (StringCloser, error)

NewWebSocketString returns a `String` binding to a web socket server specified as `url`. The resulting string will be set to the content of the latest message sent through the socket. You should also call `Close()` on the binding once you are done to free the connection.

Jump to

Keyboard shortcuts

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