Documentation ¶
Index ¶
- type Action
- type ActionInfo
- func NewActionInfoForCopiedFile(sourcePath string, targetPath string, overwritten bool) *ActionInfo
- func NewActionInfoForCopiedFolder(sourcePath string, targetPath string) *ActionInfo
- func NewActionInfoForCreated(createdPath string, folder bool) *ActionInfo
- func NewActionInfoForDeleted(deletedPath string, folder bool) *ActionInfo
- func NewActionInfoForMovedFile(sourcePath string, targetPath string, overwritten bool) *ActionInfo
- func NewActionInfoForMovedFolder(sourcePath string, targetPath string) *ActionInfo
- type Hook
- type Hooks
- type Loader
- type RunOn
- type SetupMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface { Provider() string Version() string Sample() interface{} New() Action Setup(v SetupMap) error Execute(aI *ActionInfo) error }
Action is the interface for the hook operation execution
type ActionInfo ¶
type ActionInfo struct { Time time.Time `json:"time"` Action string `json:"action"` // created, copied, moved, deleted SourcePath string `json:"sourcePath"` // full path of the source file/folder that took action TargetPath *string `json:"targetPath,omitempty"` // full path of the target file/folder that took action (only copy, move) Folder bool `json:"folder"` // path is a folder or not Overwritten bool `json:"overwritten"` // path is a file and it was overwritten }
ActionInfo struct holds the action details that should be used by the Action provider
func NewActionInfoForCopiedFile ¶
func NewActionInfoForCopiedFile(sourcePath string, targetPath string, overwritten bool) *ActionInfo
func NewActionInfoForCopiedFolder ¶
func NewActionInfoForCopiedFolder(sourcePath string, targetPath string) *ActionInfo
func NewActionInfoForCreated ¶
func NewActionInfoForCreated(createdPath string, folder bool) *ActionInfo
func NewActionInfoForDeleted ¶
func NewActionInfoForDeleted(deletedPath string, folder bool) *ActionInfo
func NewActionInfoForMovedFile ¶
func NewActionInfoForMovedFile(sourcePath string, targetPath string, overwritten bool) *ActionInfo
func NewActionInfoForMovedFolder ¶
func NewActionInfoForMovedFolder(sourcePath string, targetPath string) *ActionInfo
type Hook ¶
type Hook struct { Id *string `json:"id"` Created *time.Time `json:"created"` RunOn RunOn `json:"runOn" bson:"runOn"` Recursive bool `json:"recursive"` Provider string `json:"provider"` Setup SetupMap `json:"setup"` // contains filtered or unexported fields }
Hook struct holds the information of the action for the Folder base on RunOn setup RunOn is the type of the action that can be reason for the execution Times is the counter for the allowed executions. -1 is no limit. 0 is execution is not allowed anymore Recursive checks if the hook responsible for the sub folders Action is the action to take
type RunOn ¶
type RunOn int
const ( All RunOn = 1 // is executed in anyway Created RunOn = 2 // Folder/File or SubFolder/SubFile (if recursive) is newly Created Updated RunOn = 3 // Folder/File or SubFolder/File is Copied or Moved (Renamed) Deleted RunOn = 4 // Folder/File or SubFolder/SubFile (if recursive) is completely Deleted )
Click to show internal directories.
Click to hide internal directories.