App Konstrukt.
This commit is contained in:
parent
6daf06d19c
commit
a85d886baf
|
|
@ -1,7 +1,10 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"gittea.marcokittel.de/elio/eliotools/datawriter/internal/app"
|
"gittea.marcokittel.de/elio/eliotools/datawriter/internal/app"
|
||||||
|
"gittea.marcokittel.de/elio/eliotools/datawriter/internal/dbwriter"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -11,10 +14,17 @@ const (
|
||||||
StockMustHaveFileLen = 38
|
StockMustHaveFileLen = 38
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type dbfunction func(data dbwriter.DBWriter)
|
||||||
|
|
||||||
var filename = "2023-11-09T15:02:17+00:00-CH-stock.csv"
|
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
|
// Auf mdcat warten
|
||||||
app := app.NewApp(NewDir, ProcessedDir, Rights)
|
app := app.NewApp(NewDir, ProcessedDir, Rights)
|
||||||
app.Run()
|
app.Run()
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,21 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gittea.marcokittel.de/elio/eliotools/datawriter/internal/dbwriter"
|
||||||
"gittea.marcokittel.de/elio/eliotools/logger"
|
"gittea.marcokittel.de/elio/eliotools/logger"
|
||||||
"gittea.marcokittel.de/elio/eliotools/tools"
|
"gittea.marcokittel.de/elio/eliotools/tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
type App struct {
|
type App struct {
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
|
mu sync.Mutex
|
||||||
log logger.Logger
|
log logger.Logger
|
||||||
newFolderPath string
|
newFolderPath string
|
||||||
processedFolderPath string
|
processedFolderPath string
|
||||||
lookupPath string
|
lookupPath string
|
||||||
dirCreationRights int
|
dirCreationRights int
|
||||||
|
job func(dbwriter.DBWriter)
|
||||||
|
dbw dbwriter.DBWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewApp(newFolderPath string, processedFolderPath string, dirCreationRights int) *App {
|
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() {
|
func (a *App) Run() {
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
a.log.Fatal("Einfach nein!")
|
a.log.Fatal("Einfach nein!")
|
||||||
|
|
@ -69,7 +78,6 @@ func (a *App) Run() {
|
||||||
|
|
||||||
a.log.Info("Applikation gestartet")
|
a.log.Info("Applikation gestartet")
|
||||||
for {
|
for {
|
||||||
|
|
||||||
time.Sleep(time.Second * 10)
|
time.Sleep(time.Second * 10)
|
||||||
a.log.Info("Oh yeah baby, wir nehmen fahrt auf...")
|
a.log.Info("Oh yeah baby, wir nehmen fahrt auf...")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue