etri-smartfarm-poc-controll.../structure.go

29 lines
495 B
Go
Raw Normal View History

2021-12-10 06:45:28 +00:00
package manager
type EventStruct struct {
Event
params map[string]interface{}
key interface{}
}
func (es *EventStruct) Params() map[string]interface{} {
return es.params
}
func (es *EventStruct) Key() interface{} {
return es.key
}
2021-12-10 08:07:20 +00:00
type EventHandlerStruct struct {
EventHandler
HandleFunc func(e Event)
}
func (ehs *EventHandlerStruct) Handle(e Event) {
ehs.HandleFunc(e)
}
func NewEventHandler(h func(e Event)) *EventHandlerStruct {
return &EventHandlerStruct{HandleFunc: h}
}