Anpassung der CSV Handhabung

This commit is contained in:
Marco Kittel 2025-06-26 23:23:13 +02:00
parent 2c2a5a5f51
commit a152ec93d5
3 changed files with 24 additions and 2 deletions

View File

@ -1,13 +1,19 @@
package eliofile
import (
"fmt"
"log"
"os"
"strings"
"time"
"gittea.marcokittel.de/elio/eliotools/tools"
)
type filedata struct {
filename string
dt time.Time
}
type ElioHandleFunc func(filename string) bool
type ElioDateiFoo struct {
@ -29,6 +35,7 @@ func (f *ElioDateiFoo) ScanCsv() {
log.Fatal(err)
}
filemap := make(map[string]filedata)
for _, file := range files {
if !strings.Contains(file.Name(), "csv") {
continue
@ -37,7 +44,18 @@ func (f *ElioDateiFoo) ScanCsv() {
if err != nil {
continue
}
warehouse := tools.ExtractWarehouseAndType(file.Name())
value, ok := filemap[warehouse]
if !ok {
filemap[warehouse] = filedata{filename: file.Name(), dt: tl}
} else {
if tl.Unix() >= value.dt.Unix() {
filemap[warehouse] = filedata{filename: file.Name(), dt: tl}
}
}
}
for k, v := range filemap {
fmt.Printf("%s %s", k, v)
}
// f.process(file.Name())
}

View File

@ -2,4 +2,4 @@ module gittea.marcokittel.de/elio/eliotools/eliofile
go 1.24.4
require gittea.marcokittel.de/elio/eliotools/tools v0.0.0-20250626201301-c90924a4efa5 // indirect
require gittea.marcokittel.de/elio/eliotools/tools v0.0.0-20250626204134-2c2a5a5f5193 // indirect

View File

@ -1,2 +1,6 @@
gittea.marcokittel.de/elio/eliotools/tools v0.0.0-20250626201301-c90924a4efa5 h1:A0GZ9Z+IxL/bD9KfGetobuMTh7x+XLzwwAVWuFldHOs=
gittea.marcokittel.de/elio/eliotools/tools v0.0.0-20250626201301-c90924a4efa5/go.mod h1:jJvuXliNOiG9i8VXrY9vK5Bqv9QwDtswCs3CNIIBvUQ=
gittea.marcokittel.de/elio/eliotools/tools v0.0.0-20250626204036-96c90d3f3bd9 h1:dm58ftfBIYogZKv+JtIA3PRKS8ITd9Vhh3Z1M7QpiGg=
gittea.marcokittel.de/elio/eliotools/tools v0.0.0-20250626204036-96c90d3f3bd9/go.mod h1:jJvuXliNOiG9i8VXrY9vK5Bqv9QwDtswCs3CNIIBvUQ=
gittea.marcokittel.de/elio/eliotools/tools v0.0.0-20250626204134-2c2a5a5f5193 h1:QOq2tQjE0ViQ31r/eBMUgjnRMth5ZPwoR4L794EzdJs=
gittea.marcokittel.de/elio/eliotools/tools v0.0.0-20250626204134-2c2a5a5f5193/go.mod h1:jJvuXliNOiG9i8VXrY9vK5Bqv9QwDtswCs3CNIIBvUQ=