message

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package message provides functions for managing data used by conditions and transforms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsControl

func AsControl() func(*Message)

Types

type Message

type Message struct {
	// contains filtered or unexported fields
}

Message is the data structure that is handled by transforms and interpreted by conditions.

Data in each message may be JSON text or binary data:

  • JSON text is accessed using the GetValue, SetValue, and DeleteValue methods.
  • Binary data is accessed using the Data and SetData methods.

Metadata is a second data field that is meant to store information about the message, but can be used for any purpose. For JSON text, metadata is accessed using the GetValue, SetValue, and DeleteValue methods with a key prefixed with "meta ". Binary metadata is accessed using the Metadata and SetMetadata methods.

Messages can also be configured as "control messages." Control messages are used for flow control in Substation functions and applications, but can be used for any purpose depending on the needs of a transform or condition. These messages should not contain data or metadata.

func New

func New(opts ...func(*Message)) *Message

func (*Message) Data

func (m *Message) Data() []byte

func (*Message) DeleteValue

func (m *Message) DeleteValue(key string) error

func (*Message) GetValue

func (m *Message) GetValue(key string) Value

func (*Message) IsControl

func (m *Message) IsControl() bool

func (*Message) Metadata

func (m *Message) Metadata() []byte

func (*Message) SetData

func (m *Message) SetData(data []byte) *Message

func (*Message) SetMetadata

func (m *Message) SetMetadata(metadata []byte) *Message

func (*Message) SetValue

func (m *Message) SetValue(key string, value interface{}) error

func (*Message) String

func (m *Message) String() string

type Value

type Value struct {
	// contains filtered or unexported fields
}

Value is a wrapper around gjson.Result that provides a consistent interface for converting values from JSON text.

func (Value) Array

func (v Value) Array() []Value

func (Value) Bool

func (v Value) Bool() bool

func (Value) Bytes

func (v Value) Bytes() []byte

func (Value) Exists

func (v Value) Exists() bool

func (Value) Float

func (v Value) Float() float64

func (Value) Int

func (v Value) Int() int64

func (Value) IsArray

func (v Value) IsArray() bool

func (Value) Map

func (v Value) Map() map[string]Value

func (Value) String

func (v Value) String() string

func (Value) Uint

func (v Value) Uint() uint64

func (Value) Value

func (v Value) Value() interface{}

Jump to

Keyboard shortcuts

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