Documentation ¶
Index ¶
- Variables
- func Must(err error)
- type Event
- type EventFactory
- func (f EventFactory) MakeCall(symbol string, data Payload) *Event
- func (f EventFactory) MakeEvent(kind EventType, symbol string, data Payload) *Event
- func (f EventFactory) MakeSignal(symbol string, data Payload) *Event
- func (f EventFactory) MakeState(symbol string, data Payload) *Event
- func (f EventFactory) Sanitize(event *Event) *Event
- type EventScript
- type EventType
- type Payload
Constants ¶
This section is empty.
Variables ¶
View Source
var Emitter = helper.NewEventEmitter[*Event]()
Functions ¶
Types ¶
type Event ¶
type Event struct { Id string `json:"id" yaml:"id" csv:"id"` Source string `json:"source" yaml:"source" csv:"source"` Type EventType `json:"type" yaml:"type" csv:"type"` Timestamp time.Time `json:"timestamp" yaml:"timestamp" csv:"timestamp"` Symbol string `json:"symbol" yaml:"symbol" csv:"symbol"` Data Payload `json:"data" yaml:"data" csv:"data"` }
Event represents an API event.
func ReadCsvEvents ¶
ReadCsvEvents reads events from a csv file and sends them to the emitter channel.
func ReadJsonEvents ¶
ReadJsonEvents reads monitor events from a json stream file
type EventFactory ¶
type EventFactory struct {
Source string
}
EventFactory is used to create events. Factory associates device ids and sources with events.
func NewEventFactory ¶
func NewEventFactory(source string) *EventFactory
NewEventFactory creates a new event factory.
func (EventFactory) MakeCall ¶
func (f EventFactory) MakeCall(symbol string, data Payload) *Event
MakeCall creates a call event with the given symbol and params.
func (EventFactory) MakeEvent ¶
func (f EventFactory) MakeEvent(kind EventType, symbol string, data Payload) *Event
MakeEvent creates an event with the given kind, symbol and params.
func (EventFactory) MakeSignal ¶
func (f EventFactory) MakeSignal(symbol string, data Payload) *Event
MakeSignal creates a signal event with the given symbol and params.
func (EventFactory) MakeState ¶
func (f EventFactory) MakeState(symbol string, data Payload) *Event
MakeState creates a state event with the given symbol and props.
func (EventFactory) Sanitize ¶
func (f EventFactory) Sanitize(event *Event) *Event
Sanitize ensures events are valid and fills in missing fields.
type EventScript ¶
type EventScript struct {
// contains filtered or unexported fields
}
func NewEventScript ¶
func NewEventScript() *EventScript
func (*EventScript) RunScriptFromFile ¶
func (s *EventScript) RunScriptFromFile(file string) ([]Event, error)
Click to show internal directories.
Click to hide internal directories.