Documentation ¶
Index ¶
- Constants
- type AggregationJob
- type AggregationService
- type AliasService
- type HeartbeatService
- func (srv *HeartbeatService) CleanUp() error
- func (srv *HeartbeatService) DeleteBefore(t time.Time) error
- func (srv *HeartbeatService) GetAllWithin(from, to time.Time, user *models.User) ([]*models.Heartbeat, error)
- func (srv *HeartbeatService) GetFirstUserHeartbeats(userIds []string) ([]*models.Heartbeat, error)
- func (srv *HeartbeatService) Init()
- func (srv *HeartbeatService) InsertBatch(heartbeats []*models.Heartbeat) error
- func (srv *HeartbeatService) ScheduleCleanUp()
- type Initializable
- type Interval
- type SummaryService
- func (srv *SummaryService) Construct(from, to time.Time, user *models.User, recompute bool) (*models.Summary, error)
- func (srv *SummaryService) GetByUserWithin(user *models.User, from, to time.Time) ([]*models.Summary, error)
- func (srv *SummaryService) GetLatestByUser() ([]*models.Summary, error)
- func (srv *SummaryService) Init()
- func (srv *SummaryService) Insert(summary *models.Summary) error
- type UserService
Constants ¶
View Source
const (
TableHeartbeat = "heartbeat"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregationService ¶
type AggregationService struct { Config *models.Config Db *gorm.DB UserService *UserService SummaryService *SummaryService HeartbeatService *HeartbeatService }
func (*AggregationService) Init ¶
func (srv *AggregationService) Init()
func (*AggregationService) Schedule ¶
func (srv *AggregationService) Schedule()
Schedule a job to (re-)generate summaries every day shortly after midnight TODO: Make configurable
type AliasService ¶
func (*AliasService) GetAliasOrDefault ¶
func (*AliasService) Init ¶
func (srv *AliasService) Init()
func (*AliasService) IsInitialized ¶
func (src *AliasService) IsInitialized(userId string) bool
func (*AliasService) LoadUserAliases ¶
func (srv *AliasService) LoadUserAliases(userId string) error
type HeartbeatService ¶
func (*HeartbeatService) CleanUp ¶
func (srv *HeartbeatService) CleanUp() error
func (*HeartbeatService) DeleteBefore ¶
func (srv *HeartbeatService) DeleteBefore(t time.Time) error
func (*HeartbeatService) GetAllWithin ¶
func (*HeartbeatService) GetFirstUserHeartbeats ¶
func (srv *HeartbeatService) GetFirstUserHeartbeats(userIds []string) ([]*models.Heartbeat, error)
Will return *models.Heartbeat object with only user_id and time fields filled
func (*HeartbeatService) Init ¶
func (srv *HeartbeatService) Init()
func (*HeartbeatService) InsertBatch ¶
func (srv *HeartbeatService) InsertBatch(heartbeats []*models.Heartbeat) error
func (*HeartbeatService) ScheduleCleanUp ¶
func (srv *HeartbeatService) ScheduleCleanUp()
type Initializable ¶
type Initializable interface {
Init()
}
type SummaryService ¶
type SummaryService struct { Config *models.Config Cache *cache.Cache Db *gorm.DB HeartbeatService *HeartbeatService AliasService *AliasService }
func (*SummaryService) GetByUserWithin ¶
func (*SummaryService) GetLatestByUser ¶
func (srv *SummaryService) GetLatestByUser() ([]*models.Summary, error)
Will return *models.Summary objects with only user_id and to_time filled
func (*SummaryService) Init ¶
func (srv *SummaryService) Init()
type UserService ¶
func (*UserService) GetUserById ¶
func (srv *UserService) GetUserById(userId string) (*models.User, error)
func (*UserService) GetUserByKey ¶
func (srv *UserService) GetUserByKey(key string) (*models.User, error)
func (*UserService) Init ¶
func (srv *UserService) Init()
Click to show internal directories.
Click to hide internal directories.