fathom/pkg/count/visitors.go

24 lines
439 B
Go
Raw Normal View History

package count
2016-12-11 13:50:01 +00:00
import (
"log"
"time"
"github.com/usefathom/fathom/pkg/datastore"
)
// CreateVisitorTotals aggregates visitor data into daily totals
func CreateVisitorTotals(since string) {
tomorrow := time.Now().AddDate(0, 0, 1).Format("2006-01-02")
totals, err := datastore.VisitorCountPerDay(tomorrow, since)
if err != nil {
log.Fatal(err)
}
err = datastore.SaveVisitorTotals(totals)
if err != nil {
log.Fatal(err)
2016-12-11 15:23:13 +00:00
}
2016-12-11 15:23:13 +00:00
}