Documentation ¶
Overview ¶
Enthält eine Sammlung von gebundenen Datentypen.
Index ¶
- type Bool
- type Bytes
- type CallbackFunc
- type DataItem
- type DataListener
- type DataMap
- type ExternalBool
- type ExternalBytes
- type ExternalFloat
- type ExternalInt
- type ExternalRune
- type ExternalString
- type ExternalUntyped
- type ExternalUntypedMap
- type Float
- type Int
- type Rune
- type String
- type Struct
- type Untyped
- type UntypedMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
Bool supports binding a bool value.
func NewBool ¶
func NewBool() Bool
NewBool returns a bindable bool value that is managed internally.
func StringToBool ¶ added in v1.2.1
StringToBool creates a binding that connects a String data item to a Bool. Changes to the String will be parsed and pushed to the Bool if the parse was successful, and setting the Bool update the String binding.
func StringToBoolWithFormat ¶ added in v1.2.1
StringToBoolWithFormat creates a binding that connects a String data item to a Bool and is presented using the specified format. Changes to the Bool will be parsed and if the format matches and the parse is successful it will be pushed to the String. Setting the Bool will push a formatted value into the String.
type CallbackFunc ¶
type CallbackFunc func(data DataItem)
Neben den DataListeners gibt es noch eine schlanke Variante seinen Code bei Veränderungen eines Bind-Objektes aufrufen zu lassen: man kann einfach eine Funktion/Methode, welche dem Typ CallbackFunc entspricht, mit AddCallback hinzufügen.
type DataItem ¶
type DataItem interface { AddListener(l DataListener) RemoveListener(l DataListener) AddCallback(f CallbackFunc) RemoveCallback(f CallbackFunc) }
Mit DataItem ist das minimale Interface definiert welches ein Bind-Objekt implementieren muss. Einem Bind-Objekt können einerseits Objekte hinzugefügt werden, die das DataListener Interface implementieren, andererseits aber auch direkt Funktionen vom Typ CallbackFunc. Diese beiden Möglichkeiten können auch zusammen, d.h. synchron verwendet werden.
type DataListener ¶
type DataListener interface {
DataChanged(data DataItem)
}
Alle Typen, welche über die Aenderungen von Bind-Objekten informiert werden wollen, müssen das DataListener-Interface implementieren. Im Wesentlichen eine einzige Methode (DataChanged), welche als Argument das veränderte Bind-Objekt hat.
func NewDataListener ¶
func NewDataListener(fn func(data DataItem)) DataListener
Mit NewDataListener kann einfach und bequem ein neues Listener-Objekt erzeugt werden.
type ExternalBool ¶
type ExternalBool interface { Bool Reload() }
ExternalBool supports binding a bool value to an external value.
func BindBool ¶
func BindBool(v *bool) ExternalBool
BindBool returns a new bindable value that controls the contents of the provided bool variable. If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
type ExternalBytes ¶
type ExternalBytes interface { Bytes Reload() }
ExternalBytes supports binding a []byte value to an external value.
func BindBytes ¶
func BindBytes(v *[]byte) ExternalBytes
BindBytes returns a new bindable value that controls the contents of the provided []byte variable. If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
type ExternalFloat ¶
type ExternalFloat interface { Float Reload() }
ExternalFloat supports binding a float64 value to an external value.
func BindFloat ¶
func BindFloat(v *float64) ExternalFloat
BindFloat returns a new bindable value that controls the contents of the provided float64 variable. If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
type ExternalInt ¶
type ExternalInt interface { Int Reload() }
ExternalInt supports binding a int value to an external value.
func BindInt ¶
func BindInt(v *int) ExternalInt
BindInt returns a new bindable value that controls the contents of the provided int variable. If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
type ExternalRune ¶
type ExternalRune interface { Rune Reload() }
ExternalRune supports binding a rune value to an external value.
func BindRune ¶
func BindRune(v *rune) ExternalRune
BindRune returns a new bindable value that controls the contents of the provided rune variable. If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
type ExternalString ¶
type ExternalString interface { String Reload() }
ExternalString supports binding a string value to an external value.
func BindString ¶
func BindString(v *string) ExternalString
BindString returns a new bindable value that controls the contents of the provided string variable. If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
type ExternalUntyped ¶
type ExternalUntyped interface { Untyped Reload() }
ExternalUntyped supports binding a interface{} value to an external value.
func BindUntyped ¶
func BindUntyped(v interface{}) ExternalUntyped
BindUntyped returns a new bindable value that controls the contents of the provided interface{} variable. If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
type ExternalUntypedMap ¶ added in v1.2.1
type ExternalUntypedMap interface { UntypedMap Reload() error }
ExternalUntypedMap is a map data binding with all values untyped (interface{}), connected to an external data source.
Since: 2.0
func BindUntypedMap ¶ added in v1.2.1
func BindUntypedMap(d *map[string]interface{}) ExternalUntypedMap
BindUntypedMap creates a new map binding of string to interface{} based on the data passed. If your code changes the content of the map this refers to you should call Reload() to inform the bindings.
Since: 2.0
type Float ¶
Float supports binding a float64 value.
func NewFloat ¶
func NewFloat() Float
NewFloat returns a bindable float64 value that is managed internally.
func StringToFloat ¶ added in v1.2.1
StringToFloat creates a binding that connects a String data item to a Float. Changes to the String will be parsed and pushed to the Float if the parse was successful, and setting the Float update the String binding.
func StringToFloatWithFormat ¶ added in v1.2.1
StringToFloatWithFormat creates a binding that connects a String data item to a Float and is presented using the specified format. Changes to the Float will be parsed and if the format matches and the parse is successful it will be pushed to the String. Setting the Float will push a formatted value into the String.
type Int ¶
Int supports binding a int value.
func StringToInt ¶ added in v1.2.1
StringToInt creates a binding that connects a String data item to a Int. Changes to the String will be parsed and pushed to the Int if the parse was successful, and setting the Int update the String binding.
func StringToIntWithFormat ¶ added in v1.2.1
StringToIntWithFormat creates a binding that connects a String data item to a Int and is presented using the specified format. Changes to the Int will be parsed and if the format matches and the parse is successful it will be pushed to the String. Setting the Int will push a formatted value into the String.
type String ¶
String supports binding a string value.
func BoolToString ¶ added in v1.2.1
BoolToString creates a binding that connects a Bool data item to a String. Changes to the Bool will be pushed to the String and setting the string will parse and set the Bool if the parse was successful.
func BoolToStringWithFormat ¶ added in v1.2.1
BoolToStringWithFormat creates a binding that connects a Bool data item to a String and is presented using the specified format. Changes to the Bool will be pushed to the String and setting the string will parse and set the Bool if the string matches the format and its parse was successful.
func FloatToString ¶
FloatToString creates a binding that connects a Float data item to a String. Changes to the Float will be pushed to the String and setting the string will parse and set the Float if the parse was successful.
func FloatToStringWithFormat ¶
FloatToStringWithFormat creates a binding that connects a Float data item to a String and is presented using the specified format. Changes to the Float will be pushed to the String and setting the string will parse and set the Float if the string matches the format and its parse was successful.
func IntToString ¶
IntToString creates a binding that connects a Int data item to a String. Changes to the Int will be pushed to the String and setting the string will parse and set the Int if the parse was successful.
func IntToStringWithFormat ¶
IntToStringWithFormat creates a binding that connects a Int data item to a String and is presented using the specified format. Changes to the Int will be pushed to the String and setting the string will parse and set the Int if the string matches the format and its parse was successful.
type Struct ¶ added in v1.2.1
type Struct interface { DataMap GetValue(string) (interface{}, error) SetValue(string, interface{}) error Reload() error }
Struct is the base interface for a bound struct type.
Since: 2.0
func BindStruct ¶ added in v1.2.1
func BindStruct(i interface{}) Struct
BindStruct creates a new map binding of string to interface{} using the struct passed as data. The key for each item is a string representation of each exported field with the value set as an interface{}. Only exported fields are included.
Since: 2.0
type Untyped ¶
type Untyped interface { DataItem Get() interface{} Set(interface{}) }
Untyped supports binding a interface{} value.
func NewUntyped ¶
func NewUntyped() Untyped
NewUntyped returns a bindable interface{} value that is managed internally.
type UntypedMap ¶ added in v1.2.1
type UntypedMap interface { DataMap Delete(string) Get() (map[string]interface{}, error) GetValue(string) (interface{}, error) Set(map[string]interface{}) error SetValue(string, interface{}) error }
UntypedMap is a map data binding with all values Untyped (interface{}).
Since: 2.0
func NewUntypedMap ¶ added in v1.2.1
func NewUntypedMap() UntypedMap
NewUntypedMap creates a new, empty map binding of string to interface{}.
Since: 2.0