842da9f09b
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
34 lines
747 B
Go
34 lines
747 B
Go
package event
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func PublishEntities(name, ev string, entities interface{}) {
|
|
SharedHub().Publish(Message{
|
|
Name: fmt.Sprintf("%s.%s", name, ev),
|
|
Fields: Data{
|
|
"entities": entities,
|
|
},
|
|
})
|
|
}
|
|
|
|
func EntitiesUpdated(name string, entities interface{}) {
|
|
PublishEntities(name, "updated", entities)
|
|
}
|
|
|
|
func EntitiesCreated(name string, entities interface{}) {
|
|
PublishEntities(name, "created", entities)
|
|
}
|
|
|
|
func EntitiesDeleted(name string, entities interface{}) {
|
|
PublishEntities(name, "deleted", entities)
|
|
}
|
|
|
|
func EntitiesArchived(name string, entities interface{}) {
|
|
PublishEntities(name, "archived", entities)
|
|
}
|
|
|
|
func EntitiesRestored(name string, entities interface{}) {
|
|
PublishEntities(name, "restored", entities)
|
|
}
|