1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00
wakapi/services/aggregation.go
Ferdinand Mütsch d1be4ce2a3 Fix heartbeats insertion.
Add OS and editor fields.
Introduce aggregations (not working yet).
2019-05-09 00:07:38 +02:00

30 lines
599 B
Go

package services
import (
"database/sql"
"fmt"
"log"
"time"
"github.com/n1try/wakapi/models"
)
type AggregationService struct {
Db *sql.DB
HeartbeatService *HeartbeatService
}
func (srv *AggregationService) Aggregate(from time.Time, to time.Time, user *models.User) {
heartbeats, err := srv.HeartbeatService.GetAllFrom(from, user)
if err != nil {
log.Fatal(err)
}
for _, h := range heartbeats {
fmt.Printf("%+v\n", h)
}
}
func (srv *AggregationService) aggregateBy(*[]models.Heartbeat, models.AggregationType) *models.Aggregation {
return &models.Aggregation{}
}