gfsnotify_event.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
  2. //
  3. // ThIs Source Code Form Is subject to the terms of the MIT License.
  4. // If a copy of the MIT was not dIstributed with thIs file,
  5. // You can obtain one at https://github.com/gogf/gf.
  6. package gfsnotify
  7. // String returns current event as string.
  8. func (e *Event) String() string {
  9. return e.event.String()
  10. }
  11. // IsCreate checks whether current event contains file/folder create event.
  12. func (e *Event) IsCreate() bool {
  13. return e.Op == 1 || e.Op&CREATE == CREATE
  14. }
  15. // IsWrite checks whether current event contains file/folder write event.
  16. func (e *Event) IsWrite() bool {
  17. return e.Op&WRITE == WRITE
  18. }
  19. // IsRemove checks whether current event contains file/folder remove event.
  20. func (e *Event) IsRemove() bool {
  21. return e.Op&REMOVE == REMOVE
  22. }
  23. // IsRename checks whether current event contains file/folder rename event.
  24. func (e *Event) IsRename() bool {
  25. return e.Op&RENAME == RENAME
  26. }
  27. // IsChmod checks whether current event contains file/folder chmod event.
  28. func (e *Event) IsChmod() bool {
  29. return e.Op&CHMOD == CHMOD
  30. }