gg_watchfiles

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2024 License: BSD-3-Clause Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const (
	RulePDF  = "pdf"
	RuleTEXT = "text"
	RuleIMG  = "img"
)
View Source
const (
	NameConstraint = "name"
)

Variables

View Source
var ErrorSystemPanic = errors.New("panic_system_error")

Functions

This section is empty.

Types

type FileWrapper

type FileWrapper struct {
	Uid      string      `json:"sub-folder"`
	Filename string      `json:"filename"`
	Name     string      `json:"name"`
	Ext      string      `json:"ext"`
	Stats    os.FileInfo `json:"-"`
	Bytes    []byte      `json:"-"`
}

func (*FileWrapper) String

func (instance *FileWrapper) String() string

type FoundFiles

type FoundFiles struct {
	// contains filtered or unexported fields
}

func NewFoundFiles

func NewFoundFiles() *FoundFiles

func (*FoundFiles) Add

func (instance *FoundFiles) Add(uid, pattern string, w *FileWrapper) bool

func (*FoundFiles) Exists

func (instance *FoundFiles) Exists(uid, pattern string) bool

func (*FoundFiles) ExistsFile

func (instance *FoundFiles) ExistsFile(uid, filename string) bool

func (*FoundFiles) GetFiles

func (instance *FoundFiles) GetFiles(uid string) (response []*FileWrapper)

func (*FoundFiles) Len

func (instance *FoundFiles) Len(uid string) int

func (*FoundFiles) Reset

func (instance *FoundFiles) Reset(uid string)

func (*FoundFiles) ResetAll

func (instance *FoundFiles) ResetAll()

func (*FoundFiles) String

func (instance *FoundFiles) String() string

type MultipleFileEventParam

type MultipleFileEventParam struct {
	Files        []*FileWrapper `json:"files"`
	Error        error          `json:"error"`
	ErrorContext string         `json:"error-context"`
}

func (*MultipleFileEventParam) String

func (instance *MultipleFileEventParam) String() string

type MultipleFileWatcher

type MultipleFileWatcher struct {
	// contains filtered or unexported fields
}

func NewMultipleFileWatcher

func NewMultipleFileWatcher(settings *MultipleFileWatcherSettings, optEvents *gg_events.Emitter) (instance *MultipleFileWatcher)

func (*MultipleFileWatcher) GetCheckIntervalMs

func (instance *MultipleFileWatcher) GetCheckIntervalMs() (response int)

func (*MultipleFileWatcher) GetConstraintsMode

func (instance *MultipleFileWatcher) GetConstraintsMode() (response bool)

func (*MultipleFileWatcher) GetDirs

func (instance *MultipleFileWatcher) GetDirs() (response []string)

func (*MultipleFileWatcher) GetEventNameOnFileWatch

func (instance *MultipleFileWatcher) GetEventNameOnFileWatch() string

func (*MultipleFileWatcher) GetExtraConstraints

func (instance *MultipleFileWatcher) GetExtraConstraints() (response []string)

func (*MultipleFileWatcher) GetFilePatterns

func (instance *MultipleFileWatcher) GetFilePatterns() (response []string)

func (*MultipleFileWatcher) GetIncludeSubFolders

func (instance *MultipleFileWatcher) GetIncludeSubFolders() (response bool)

func (*MultipleFileWatcher) Join

func (instance *MultipleFileWatcher) Join()

func (*MultipleFileWatcher) OnFileWatch

func (instance *MultipleFileWatcher) OnFileWatch(callback func(event *gg_events.Event)) *MultipleFileWatcher

func (*MultipleFileWatcher) SetCheckIntervalMs

func (instance *MultipleFileWatcher) SetCheckIntervalMs(value int) *MultipleFileWatcher

func (*MultipleFileWatcher) SetConstraintsMode

func (instance *MultipleFileWatcher) SetConstraintsMode(value bool) *MultipleFileWatcher

func (*MultipleFileWatcher) SetDirs

func (instance *MultipleFileWatcher) SetDirs(value []string) *MultipleFileWatcher

func (*MultipleFileWatcher) SetEventNameOnFileWatch

func (instance *MultipleFileWatcher) SetEventNameOnFileWatch(value string) *MultipleFileWatcher

func (*MultipleFileWatcher) SetExtraConstraints

func (instance *MultipleFileWatcher) SetExtraConstraints(value []string) *MultipleFileWatcher

func (*MultipleFileWatcher) SetFilePatterns

func (instance *MultipleFileWatcher) SetFilePatterns(value []string) *MultipleFileWatcher

func (*MultipleFileWatcher) SetIncludeSubFolders

func (instance *MultipleFileWatcher) SetIncludeSubFolders(value bool) *MultipleFileWatcher

func (*MultipleFileWatcher) Start

func (instance *MultipleFileWatcher) Start()

func (*MultipleFileWatcher) Stop

func (instance *MultipleFileWatcher) Stop()

func (*MultipleFileWatcher) String

func (instance *MultipleFileWatcher) String() string

type MultipleFileWatcherRule

type MultipleFileWatcherRule struct {
	FilePattern   string `json:"file-pattern"`
	FileValidator string `json:"file-validator"` // "func", "text", "pdf", content regexp
}

func (*MultipleFileWatcherRule) Match

func (instance *MultipleFileWatcherRule) Match(filename string) (match, validated bool, err error)

func (*MultipleFileWatcherRule) String

func (instance *MultipleFileWatcherRule) String() string

type MultipleFileWatcherRules

type MultipleFileWatcherRules struct {
	Rules []*MultipleFileWatcherRule `json:"rules"`
}

func NewMultipleFileWatcherRules

func NewMultipleFileWatcherRules() (instance *MultipleFileWatcherRules)

func (*MultipleFileWatcherRules) IsValid

func (instance *MultipleFileWatcherRules) IsValid(filename string) bool

func (*MultipleFileWatcherRules) Match

func (instance *MultipleFileWatcherRules) Match(filename string) (match, validated bool, err error)

func (*MultipleFileWatcherRules) String

func (instance *MultipleFileWatcherRules) String() string

type MultipleFileWatcherSettings

type MultipleFileWatcherSettings struct {
	Dirs              []string `json:"dirs"` // directories to monitor for file
	IncludeSubFolders bool     `json:"include-sub-folders"`
	FilePatterns      []string `json:"patterns"`         // define the number of files and pattern required i.e. "*.xml"
	HasConstraint     bool     `json:"has-constraint"`   // "patterns" are used as constraint
	ExtraConstraints  []string `json:"extra-constraint"` // ["name"] a special constraint to be evaluated before considering a right constraint match
	TriggerEventName  string   `json:"trigger-event-name"`
	CheckIntervalMs   int      `json:"check-interval-ms"`
}

type WatchFilesHelper

type WatchFilesHelper struct {
}
var WatchFiles *WatchFilesHelper

func (*WatchFilesHelper) GetEventParam

func (instance *WatchFilesHelper) GetEventParam(event *gg_events.Event) (response *MultipleFileEventParam)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL