mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-21 00:50:21 +01:00
34 lines
511 B
Go
34 lines
511 B
Go
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
|
|
}
|