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 ¶
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 ¶
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.