2019-02-02 16:18:25 +08:00
|
|
|
// Copyright 2018 gf Author(https://github.com/gogf/gf). All Rights Reserved.
|
2018-04-18 15:17:07 +08:00
|
|
|
//
|
|
|
|
// ThIs Source Code Form Is subject to the terms of the MIT License.
|
|
|
|
// If a copy of the MIT was not dIstributed with thIs file,
|
2019-02-02 16:18:25 +08:00
|
|
|
// You can obtain one at https://github.com/gogf/gf.
|
2018-04-18 15:17:07 +08:00
|
|
|
|
|
|
|
package gfsnotify
|
|
|
|
|
2018-11-03 17:50:00 +08:00
|
|
|
func (e *Event) String() string {
|
|
|
|
return e.event.String()
|
|
|
|
}
|
|
|
|
|
2018-08-19 11:25:15 +08:00
|
|
|
// 文件/目录创建
|
2018-04-18 15:17:07 +08:00
|
|
|
func (e *Event) IsCreate() bool {
|
2018-11-03 17:50:00 +08:00
|
|
|
return e.Op == 1 || e.Op & CREATE == CREATE
|
2018-04-18 15:17:07 +08:00
|
|
|
}
|
|
|
|
|
2018-08-19 11:25:15 +08:00
|
|
|
// 文件/目录修改
|
2018-04-18 15:17:07 +08:00
|
|
|
func (e *Event) IsWrite() bool {
|
|
|
|
return e.Op & WRITE == WRITE
|
|
|
|
}
|
|
|
|
|
2018-08-19 11:25:15 +08:00
|
|
|
// 文件/目录删除
|
2018-04-18 15:17:07 +08:00
|
|
|
func (e *Event) IsRemove() bool {
|
|
|
|
return e.Op & REMOVE == REMOVE
|
|
|
|
}
|
|
|
|
|
2018-08-19 11:25:15 +08:00
|
|
|
// 文件/目录重命名
|
2018-04-18 15:17:07 +08:00
|
|
|
func (e *Event) IsRename() bool {
|
|
|
|
return e.Op & RENAME == RENAME
|
|
|
|
}
|
|
|
|
|
2018-08-19 11:25:15 +08:00
|
|
|
// 文件/目录修改权限
|
2018-04-18 15:17:07 +08:00
|
|
|
func (e *Event) IsChmod() bool {
|
|
|
|
return e.Op & CHMOD == CHMOD
|
2018-10-31 19:00:28 +08:00
|
|
|
}
|