photoprism/internal/event/entity.go
Michael Mayer c1b08c8870 Backend: Code clean-up
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-03-09 01:13:32 +01:00

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)
}