2020-02-04 11:38:43 +01:00
|
|
|
package event
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
func PublishEntities(name, ev string, entities interface{}) {
|
|
|
|
SharedHub().Publish(Message{
|
2020-03-09 01:13:32 +01:00
|
|
|
Name: fmt.Sprintf("%s.%s", name, ev),
|
2020-02-04 11:38:43 +01:00
|
|
|
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)
|
|
|
|
}
|