mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-01 06:33:18 +02:00
preparing for v0.5
This commit is contained in:
33
src/watcher/event.go
Normal file
33
src/watcher/event.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package watcher
|
||||
|
||||
import "fmt"
|
||||
|
||||
type (
|
||||
Event struct {
|
||||
ActorName string
|
||||
Action Action
|
||||
}
|
||||
Action string
|
||||
)
|
||||
|
||||
const (
|
||||
ActionModified Action = "MODIFIED"
|
||||
ActionDeleted Action = "DELETED"
|
||||
ActionCreated Action = "CREATED"
|
||||
)
|
||||
|
||||
func (e *Event) String() string {
|
||||
return fmt.Sprintf("%s %s", e.ActorName, e.Action)
|
||||
}
|
||||
|
||||
func (a Action) IsDelete() bool {
|
||||
return a == ActionDeleted
|
||||
}
|
||||
|
||||
func (a Action) IsModify() bool {
|
||||
return a == ActionModified
|
||||
}
|
||||
|
||||
func (a Action) IsCreate() bool {
|
||||
return a == ActionCreated
|
||||
}
|
||||
Reference in New Issue
Block a user