c1b08c8870
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
32 lines
742 B
Go
32 lines
742 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)
|
|
}
|