fwatcher

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyExcelFolder = "path"
)

Variables

View Source
var ErrorOpenFileFailed = errors.New("failed to open file")
View Source
var FileWatcheSettingKey = "files"

Functions

func FileExisted

func FileExisted(file string) bool

Types

type FileAction

type FileAction interface {
	HandleFile(file string) error
}

type FileIdempotent

type FileIdempotent struct {
	Logger *zap.Logger
	Key    string
	File   string
	DB     *gorm.DB
}

type FileIdempotentParams

type FileIdempotentParams struct {
	Db *gorm.DB `optional:"true"`
}

type FileWatcherParams

type FileWatcherParams struct {
	dig.In
	Ctx        context.Context
	Logger     *zap.Logger
	Action     FileAction
	Idempotent *FileIdempotent `optional:"true"`
}

type FilelWatcher

type FilelWatcher struct {
	Logger        *zap.Logger
	Action        FileAction
	Recursive     bool
	Path          string
	Interval      time.Duration
	Included      []string
	Excluded      []string
	RetryDelay    time.Duration
	RetryAttempts uint
	Delete        bool
	DoneFolder    string
	ErrorFolder   string
}

FileWatcher, not support recursion & idempotent yet.

func (*FilelWatcher) Filter

func (e *FilelWatcher) Filter(file string) bool

func (*FilelWatcher) ScheduleWalk

func (e *FilelWatcher) ScheduleWalk(ctx context.Context)

func (*FilelWatcher) StartService

func (e *FilelWatcher) StartService(ctx context.Context)

func (*FilelWatcher) StartWatcher

func (e *FilelWatcher) StartWatcher(ctx context.Context) error

func (*FilelWatcher) Walk

func (e *FilelWatcher) Walk()

Jump to

Keyboard shortcuts

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