Csv Extension in Konstante ausgelagert.
This commit is contained in:
parent
531bb5ba41
commit
bf86ab9c83
|
|
@ -10,6 +10,8 @@ import (
|
|||
"gittea.marcokittel.de/elio/eliotools/tools"
|
||||
)
|
||||
|
||||
const FileExt = "csv"
|
||||
|
||||
type filedata struct {
|
||||
filename string
|
||||
dt time.Time
|
||||
|
|
@ -17,12 +19,13 @@ type filedata struct {
|
|||
type ElioHandleFunc func(filename string) bool
|
||||
|
||||
type ElioDateiFoo struct {
|
||||
process ElioHandleFunc
|
||||
dir string
|
||||
process ElioHandleFunc
|
||||
lookUpDir string
|
||||
processedDir string
|
||||
}
|
||||
|
||||
func NewElioDateiFoo(dir string, process ElioHandleFunc) *ElioDateiFoo {
|
||||
df := ElioDateiFoo{dir: dir,
|
||||
func NewElioDateiFoo(lookUpDir string, process ElioHandleFunc) *ElioDateiFoo {
|
||||
df := ElioDateiFoo{lookUpDir: lookUpDir,
|
||||
process: process,
|
||||
}
|
||||
return &df
|
||||
|
|
@ -34,7 +37,7 @@ func NewElioDateiFoo(dir string, process ElioHandleFunc) *ElioDateiFoo {
|
|||
// Veraltete Dateien mit Präfix no-import und Postifx .old benennen.
|
||||
// Gültige Dateinamen zur Extraktion in Closure übergeben.
|
||||
func (f *ElioDateiFoo) ScanCsv() {
|
||||
files, err := os.ReadDir(f.dir)
|
||||
files, err := os.ReadDir(f.lookUpDir)
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
@ -42,7 +45,7 @@ func (f *ElioDateiFoo) ScanCsv() {
|
|||
|
||||
filemap := make(map[string]filedata)
|
||||
for _, file := range files {
|
||||
if !strings.Contains(file.Name(), "csv") {
|
||||
if !strings.Contains(file.Name(), FileExt) {
|
||||
continue
|
||||
}
|
||||
tl, err := tools.ExtractDateAndConvertToDate(file.Name())
|
||||
|
|
|
|||
Loading…
Reference in New Issue