json_type

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPayloadMetricNil = fmt.Errorf("payload metrics is nil")
View Source
var ErrPayloadMetricNilHasProperties = fmt.Errorf("payload metrics is nil, properties are not nil")

Functions

This section is empty.

Types

type JsonType

type JsonType interface {
	MarshalJSON() ([]byte, error)
	MarshalBinary() ([]byte, error)
	String() string
	Bytes() []byte
}

JsonType is an interface that represents either a number, string, boolean, or an array of those types. It's intented to serialize single values or arrays of values to JSON

func MetricValueToJsonType

func MetricValueToJsonType(metric *sparkplug.Payload_Metric) (JsonType, error)

MetricValueToJsonType will convert a sparkplug datatype to a JSON type, one of: number, string, boolean, array

func NodeValueToJsonType

func NodeValueToJsonType(variant *ua.Variant) (JsonType, error)

NodeValueToJsonType will convert a OPC UA Node type to a JSON type, one of: number, string, boolean, array

Jump to

Keyboard shortcuts

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