events

package
v0.0.0-...-ab5431c Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: AGPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadTimestamp = fmt.Errorf("bad timestamp")
View Source
var ErrNoMatch = fmt.Errorf("event mismatch")

Functions

func GetDeviceID

func GetDeviceID(m senml.Pack) string

func GetObjectID

func GetObjectID(m senml.Pack) string

func GetObjectURN

func GetObjectURN(m senml.Pack) string

func Matches

func Matches(m Message, objectURN string) bool

Types

type EventDecoratorFunc

type EventDecoratorFunc func(m Message)

func Environment

func Environment(e string) EventDecoratorFunc

func Lat

func Lon

func Rec

func Rec(n, vs string, v *float64, vb *bool, t float64, sum *float64) EventDecoratorFunc

func Source

func Source(s string) EventDecoratorFunc

func Tenant

func Tenant(t string) EventDecoratorFunc

type Message

type Message interface {
	DeviceID() string
	ObjectID() string
	Pack() senml.Pack
	Append(r senml.Record)
	Replace(r senml.Record, find func(senml.Record) bool)
	Tenant() string
	Error() error
}

type MessageAccepted

type MessageAccepted struct {
	Pack_     senml.Pack `json:"pack"`
	Timestamp time.Time  `json:"timestamp"`
}

func NewMessageAccepted

func NewMessageAccepted(pack senml.Pack, decorators ...EventDecoratorFunc) *MessageAccepted

func (*MessageAccepted) Append

func (m *MessageAccepted) Append(r senml.Record)

func (MessageAccepted) Body

func (m MessageAccepted) Body() []byte

func (MessageAccepted) ContentType

func (m MessageAccepted) ContentType() string

func (MessageAccepted) DeviceID

func (m MessageAccepted) DeviceID() string

func (MessageAccepted) Error

func (m MessageAccepted) Error() error

func (MessageAccepted) ObjectID

func (m MessageAccepted) ObjectID() string

func (MessageAccepted) Pack

func (m MessageAccepted) Pack() senml.Pack

func (*MessageAccepted) Replace

func (m *MessageAccepted) Replace(r senml.Record, find func(senml.Record) bool)

func (MessageAccepted) Tenant

func (m MessageAccepted) Tenant() string

func (MessageAccepted) TopicName

func (m MessageAccepted) TopicName() string

type MessageReceived

type MessageReceived struct {
	Pack_     senml.Pack `json:"pack"`
	Timestamp time.Time  `json:"timestamp"`
}

func NewMessageReceived

func NewMessageReceived(pack senml.Pack, decorators ...EventDecoratorFunc) *MessageReceived

func (*MessageReceived) Append

func (m *MessageReceived) Append(r senml.Record)

func (MessageReceived) Body

func (m MessageReceived) Body() []byte

func (MessageReceived) ContentType

func (m MessageReceived) ContentType() string

func (MessageReceived) DeviceID

func (m MessageReceived) DeviceID() string

func (MessageReceived) Error

func (m MessageReceived) Error() error

func (MessageReceived) ObjectID

func (m MessageReceived) ObjectID() string

func (MessageReceived) Pack

func (m MessageReceived) Pack() senml.Pack

func (*MessageReceived) Replace

func (m *MessageReceived) Replace(r senml.Record, find func(senml.Record) bool)

func (MessageReceived) Tenant

func (m MessageReceived) Tenant() string

func (MessageReceived) TopicName

func (m MessageReceived) TopicName() string

type MessageTransformed

type MessageTransformed struct {
	Pack_     senml.Pack `json:"pack"`
	Timestamp time.Time  `json:"timestamp"`
}

func NewMessageTransformed

func NewMessageTransformed(pack senml.Pack, decorators ...EventDecoratorFunc) *MessageTransformed

func (*MessageTransformed) Append

func (m *MessageTransformed) Append(r senml.Record)

func (MessageTransformed) Body

func (m MessageTransformed) Body() []byte

func (MessageTransformed) ContentType

func (m MessageTransformed) ContentType() string

func (MessageTransformed) DeviceID

func (m MessageTransformed) DeviceID() string

func (MessageTransformed) Error

func (m MessageTransformed) Error() error

func (MessageTransformed) ObjectID

func (m MessageTransformed) ObjectID() string

func (MessageTransformed) Pack

func (m MessageTransformed) Pack() senml.Pack

func (*MessageTransformed) Replace

func (m *MessageTransformed) Replace(r senml.Record, find func(senml.Record) bool)

func (MessageTransformed) Tenant

func (m MessageTransformed) Tenant() string

func (MessageTransformed) TopicName

func (m MessageTransformed) TopicName() string

Jump to

Keyboard shortcuts

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