43 lines
748 B
Go
43 lines
748 B
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
"runtime"
|
|
"sync"
|
|
|
|
"gittea.marcokittel.de/elio/eliotools/datawriter/internal/dbwriter"
|
|
"gittea.marcokittel.de/elio/eliotools/logger"
|
|
)
|
|
|
|
type App struct {
|
|
wg *sync.WaitGroup
|
|
mu sync.Mutex
|
|
log logger.Logger
|
|
}
|
|
|
|
func NewApp(wg *sync.WaitGroup) *App {
|
|
a := App{log: logger.NewMarcoLogger(),
|
|
wg: wg,
|
|
}
|
|
return &a
|
|
}
|
|
|
|
func (a *App) HandleData(ctx context.Context, data dbwriter.MyStruct) error {
|
|
a.log.Info("HandleData")
|
|
return nil
|
|
}
|
|
|
|
func (a *App) AppendData(data dbwriter.MyStruct) error {
|
|
a.log.Info("Verarbeite Daten: " + data.A + " " + string(data.B))
|
|
//Todo
|
|
return nil
|
|
}
|
|
func (a *App) Run() {
|
|
if runtime.GOOS == "windows" {
|
|
a.log.Fatal("Einfach nein!")
|
|
}
|
|
|
|
a.log.Info("Applikation gestartet")
|
|
|
|
}
|