2021-12-16 11:11:46 +00:00
|
|
|
package history
|
|
|
|
|
2021-12-16 13:43:56 +00:00
|
|
|
import (
|
2021-12-20 02:23:08 +00:00
|
|
|
"github.com/rs/zerolog"
|
2021-12-16 13:43:56 +00:00
|
|
|
"kumoly.io/kumoly/app/store"
|
2021-12-20 02:23:08 +00:00
|
|
|
"kumoly.io/kumoly/app/util"
|
2021-12-16 13:43:56 +00:00
|
|
|
)
|
2021-12-16 11:11:46 +00:00
|
|
|
|
|
|
|
type Service struct {
|
|
|
|
}
|
|
|
|
|
2021-12-20 02:23:08 +00:00
|
|
|
var l zerolog.Logger
|
|
|
|
|
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 {
|
2021-12-20 02:23:08 +00:00
|
|
|
l = util.Klog.With().Str("mod", "history").Logger()
|
2021-12-16 13:43:56 +00:00
|
|
|
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 }
|