mirror of
https://github.com/mudler/luet.git
synced 2025-09-02 15:54:39 +00:00
Update go-pluggable
- Update vendor and run go mod tidy
This commit is contained in:
11
vendor/github.com/mudler/go-pluggable/events.go
generated
vendored
11
vendor/github.com/mudler/go-pluggable/events.go
generated
vendored
@@ -15,7 +15,10 @@
|
||||
|
||||
package pluggable
|
||||
|
||||
import "encoding/json"
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// EventType describes an event type
|
||||
type EventType string
|
||||
@@ -42,6 +45,10 @@ func (e Event) JSON() (string, error) {
|
||||
return string(dat), err
|
||||
}
|
||||
|
||||
func (e Event) ResponseEventName(s string) EventType {
|
||||
return EventType(fmt.Sprintf("%s-%s", e.Name, s))
|
||||
}
|
||||
|
||||
// Unmarshal decodes the json payload in the given parameteer
|
||||
func (r EventResponse) Unmarshal(i interface{}) error {
|
||||
return json.Unmarshal([]byte(r.Data), i)
|
||||
@@ -52,7 +59,7 @@ func (r EventResponse) Errored() bool {
|
||||
return len(r.Error) != 0
|
||||
}
|
||||
|
||||
// NewEvent retuns a new event which can be used for publishing
|
||||
// NewEvent returns a new event which can be used for publishing
|
||||
// the obj gets automatically serialized in json.
|
||||
func NewEvent(name EventType, obj interface{}) (*Event, error) {
|
||||
dat, err := json.Marshal(obj)
|
||||
|
Reference in New Issue
Block a user