Versions in this module Expand all Collapse all v1 v1.1.0 Jul 3, 2020 v1.0.0 Jun 26, 2020 Changes in this version + func Fingerprint(r *http.Request) string + func RunAtMidnight(f func()) + type Analyzer struct + func NewAnalyzer(store Store) *Analyzer + func (analyzer *Analyzer) ActiveVisitors(d time.Duration) (int, error) + func (analyzer *Analyzer) HourlyVisitors(filter *Filter) ([]HourlyVisitors, error) + func (analyzer *Analyzer) Languages(filter *Filter) ([]VisitorLanguage, int, error) + func (analyzer *Analyzer) PageVisits(filter *Filter) ([]PageVisits, error) + func (analyzer *Analyzer) Visitors(filter *Filter) ([]VisitorsPerDay, error) + type Filter struct + From time.Time + To time.Time + func (filter *Filter) Days() int + type Hit struct + Fingerprint string + ID int64 + Language string + Path string + Ref string + Time time.Time + URL string + UserAgent string + func (hit Hit) String() string + type HourlyVisitors struct + Hour int + Visitors int + type PageVisits struct + Path string + Visits []VisitorsPerDay + type PostgresStore struct + DB *sqlx.DB + func NewPostgresStore(db *sql.DB) *PostgresStore + func (store *PostgresStore) ActiveVisitors(from time.Time) (int, error) + func (store *PostgresStore) Days() ([]time.Time, error) + func (store *PostgresStore) DeleteHitsByDay(day time.Time) error + func (store *PostgresStore) HourlyVisitors(from, to time.Time) ([]HourlyVisitors, error) + func (store *PostgresStore) PageVisits(path string, from, to time.Time) ([]VisitorsPerDay, error) + func (store *PostgresStore) Paths(from, to time.Time) ([]string, error) + func (store *PostgresStore) Save(hits []Hit) error + func (store *PostgresStore) SaveVisitorsPerDay(visitors *VisitorsPerDay) error + func (store *PostgresStore) SaveVisitorsPerHour(visitors *VisitorsPerHour) error + func (store *PostgresStore) SaveVisitorsPerLanguage(visitors *VisitorsPerLanguage) error + func (store *PostgresStore) SaveVisitorsPerPage(visitors *VisitorsPerPage) error + func (store *PostgresStore) VisitorLanguages(from, to time.Time) ([]VisitorLanguage, error) + func (store *PostgresStore) Visitors(from, to time.Time) ([]VisitorsPerDay, error) + func (store *PostgresStore) VisitorsPerDay(day time.Time) (int, error) + func (store *PostgresStore) VisitorsPerDayAndHour(day time.Time) ([]VisitorsPerHour, error) + func (store *PostgresStore) VisitorsPerLanguage(day time.Time) ([]VisitorsPerLanguage, error) + func (store *PostgresStore) VisitorsPerPage(day time.Time) ([]VisitorsPerPage, error) + type Processor struct + func NewProcessor(store Store) *Processor + func (processor *Processor) Process() + type Store interface + ActiveVisitors func(time.Time) (int, error) + Days func() ([]time.Time, error) + DeleteHitsByDay func(time.Time) error + HourlyVisitors func(time.Time, time.Time) ([]HourlyVisitors, error) + PageVisits func(string, time.Time, time.Time) ([]VisitorsPerDay, error) + Paths func(time.Time, time.Time) ([]string, error) + Save func([]Hit) error + SaveVisitorsPerDay func(*VisitorsPerDay) error + SaveVisitorsPerHour func(*VisitorsPerHour) error + SaveVisitorsPerLanguage func(*VisitorsPerLanguage) error + SaveVisitorsPerPage func(*VisitorsPerPage) error + VisitorLanguages func(time.Time, time.Time) ([]VisitorLanguage, error) + Visitors func(time.Time, time.Time) ([]VisitorsPerDay, error) + VisitorsPerDay func(time.Time) (int, error) + VisitorsPerDayAndHour func(time.Time) ([]VisitorsPerHour, error) + VisitorsPerLanguage func(time.Time) ([]VisitorsPerLanguage, error) + VisitorsPerPage func(time.Time) ([]VisitorsPerPage, error) + type Tracker struct + func NewTracker(store Store, config *TrackerConfig) *Tracker + func (tracker *Tracker) Flush() + func (tracker *Tracker) Hit(r *http.Request) + func (tracker *Tracker) HitPage(r *http.Request, path string) + func (tracker *Tracker) Stop() + type TrackerConfig struct + Worker int + WorkerBufferSize int + WorkerTimeout time.Duration + type VisitorLanguage struct + Language string + RelativeVisitors float64 + Visitors int + type VisitorsPerDay struct + Day time.Time + ID int64 + Visitors int + type VisitorsPerHour struct + DayAndHour time.Time + ID int64 + Visitors int + type VisitorsPerLanguage struct + Day time.Time + ID int64 + Language string + Visitors int + type VisitorsPerPage struct + Day time.Time + ID int64 + Path string + Visitors int