app/history/service.go

38 lines
905 B
Go
Raw Normal View History

2021-12-16 11:11:46 +00:00
package history
2021-12-16 13:43:56 +00:00
import (
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"kumoly.io/kumoly/app/store"
)
2021-12-16 11:11:46 +00:00
type Service struct {
}
2021-12-16 16:25:29 +00:00
func (srv Service) GetName() string { return "history.Service" }
func (srv Service) IsService() bool { return true }
func (srv Service) GetDependencies() []string { return []string{"server.Service"} }
2021-12-16 13:43:56 +00:00
func (srv Service) Init() error {
PROD = viper.GetBool("prod")
l := log.With().Str("mod", "history").
Str("service", "history.Service").
Logger()
l.Debug().Msg("Migrating database for history.Service ...")
if err := store.Migrate(&History{}); err != nil {
l.Error().Err(err).Msg("Migrating database")
return err
}
return nil
}
2021-12-16 11:11:46 +00:00
func (srv Service) Main() error {
Start(DBReceiver)
return nil
}
func (srv Service) Del() {
Stop()
}
2021-12-17 07:52:32 +00:00
func (srv Service) Load() error { return nil }
func (srv Service) Health() error { return nil }