github.com/zhongdalu/gf@v1.0.0/g/os/gfsnotify/gfsnotify_event.go (about)

     1  // Copyright 2018 gf Author(https://github.com/zhongdalu/gf). 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/zhongdalu/gf.
     6  
     7  package gfsnotify
     8  
     9  func (e *Event) String() string {
    10  	return e.event.String()
    11  }
    12  
    13  // 文件/目录创建
    14  func (e *Event) IsCreate() bool {
    15  	return e.Op == 1 || e.Op&CREATE == CREATE
    16  }
    17  
    18  // 文件/目录修改
    19  func (e *Event) IsWrite() bool {
    20  	return e.Op&WRITE == WRITE
    21  }
    22  
    23  // 文件/目录删除
    24  func (e *Event) IsRemove() bool {
    25  	return e.Op&REMOVE == REMOVE
    26  }
    27  
    28  // 文件/目录重命名
    29  func (e *Event) IsRename() bool {
    30  	return e.Op&RENAME == RENAME
    31  }
    32  
    33  // 文件/目录修改权限
    34  func (e *Event) IsChmod() bool {
    35  	return e.Op&CHMOD == CHMOD
    36  }