forked from photoprism/photoprism
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentity.go
34 lines (27 loc) · 747 Bytes
/
entity.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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)
}