binder

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JSON  = jsonBinder{}
	Text  = textBinder{}
	Topic = topicBinder{}
)

Available data binders.

View Source
var JSONDisallowUnknownFields = false

JSONDisallowUnknownFields causes the Decoder to return an error when the destination is a struct and the input contains object keys which do not match any non-ignored, exported fields in the destination.

View Source
var JSONUseNumber = false

JSONUseNumber causes the Decoder to unmarshal a number into an interface{} as a Number instead of as a float64.

Functions

func Validate

func Validate(obj interface{}) error

Validate validates the given struct.

Types

type DataBinder

type DataBinder interface {
	// Name of the binder
	Name() string
	// Bind unmarshal payload to an object
	Bind([]byte, interface{}) error
}

DataBinder describes the interface which needs to be implemented for binding the data present in the MQTT payload.

Jump to

Keyboard shortcuts

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