App Konstrukt.

This commit is contained in:
Marco Kittel 2025-06-22 23:50:43 +02:00
parent 6daf06d19c
commit a85d886baf
3 changed files with 39 additions and 2 deletions

View File

@ -1,7 +1,10 @@
package main
import (
"fmt"
"gittea.marcokittel.de/elio/eliotools/datawriter/internal/app"
"gittea.marcokittel.de/elio/eliotools/datawriter/internal/dbwriter"
)
const (
@ -11,10 +14,17 @@ const (
StockMustHaveFileLen = 38
)
type dbfunction func(data dbwriter.DBWriter)
var filename = "2023-11-09T15:02:17+00:00-CH-stock.csv"
func main() {
func GetDbBehavior() dbfunction {
return func(data dbwriter.DBWriter) {
fmt.Println("Db Behavior")
}
}
func main() {
// Auf mdcat warten
app := app.NewApp(NewDir, ProcessedDir, Rights)
app.Run()

View File

@ -7,17 +7,21 @@ import (
"sync"
"time"
"gittea.marcokittel.de/elio/eliotools/datawriter/internal/dbwriter"
"gittea.marcokittel.de/elio/eliotools/logger"
"gittea.marcokittel.de/elio/eliotools/tools"
)
type App struct {
wg sync.WaitGroup
mu sync.Mutex
log logger.Logger
newFolderPath string
processedFolderPath string
lookupPath string
dirCreationRights int
job func(dbwriter.DBWriter)
dbw dbwriter.DBWriter
}
func NewApp(newFolderPath string, processedFolderPath string, dirCreationRights int) *App {
@ -62,6 +66,11 @@ func (a *App) Foo() {
}
}
func (a *App) write(data dbwriter.MyStruct) {
a.log.Info("Okay.... wir sind jetzt hier..... Hier können wir die Spiele beginnen lassen")
}
func (a *App) Run() {
if runtime.GOOS == "windows" {
a.log.Fatal("Einfach nein!")
@ -69,7 +78,6 @@ func (a *App) Run() {
a.log.Info("Applikation gestartet")
for {
time.Sleep(time.Second * 10)
a.log.Info("Oh yeah baby, wir nehmen fahrt auf...")
}

View File

@ -0,0 +1,19 @@
package dbwriter
import "fmt"
type MyStruct struct {
A string
B int
}
type DBWriter interface {
write(data MyStruct)
}
type DBWrite struct {
}
func (d *DBWrite) write(data MyStruct) {
fmt.Println("\n\n DB WRITER \n\n")
}